Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single line doc blocks not supported? #2345

Closed
Dmitrev opened this issue Aug 21, 2023 · 1 comment · Fixed by #2350
Closed

Single line doc blocks not supported? #2345

Dmitrev opened this issue Aug 21, 2023 · 1 comment · Fixed by #2350

Comments

@Dmitrev
Copy link
Contributor

Dmitrev commented Aug 21, 2023

Summary

Phpactor seems to not support single line comments that are supported by Phpdoc
Tests are all targeted at multi line. Any plans to support this?

I would love to give it a go, if I can manage to get a development environment up and running for Phpactor

Single line comment

Single line comment (no comment shown)
image

Server log:

[DEBUG][2023-08-21 09:42:23] .../lua/vim/lsp.lua:1392	"LSP[phpactor]"	"client.request"	1	"textDocument/hover"	{  position = {    character = 20,    line = 11  },  textDocument = {    uri = "file:///home/dmitri/sites/meg-worktree/feature/tests/Unit/ATest.php"  }}	<function 1>	1
[DEBUG][2023-08-21 09:42:23] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 2,  jsonrpc = "2.0",  method = "textDocument/hover",  params = {    position = {      character = 20,      line = 11    },    textDocument = {      uri = "file:///home/dmitri/sites/meg-worktree/feature/tests/Unit/ATest.php"    }  }}
[DEBUG][2023-08-21 09:42:24] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  id = 2,  jsonrpc = "2.0",  result = {    contents = {      kind = "markdown",      value = "### ATest # singleLineComment\n\n```php\n<?php public function singleLineComment(): void\n```"    },    range = {      ["end"] = {        character = 37,        line = 11      },      start = {        character = 20,        line = 11      }    }  }}

Multi line comment

Multi line comment (comment is shown)
image

Server log:

[DEBUG][2023-08-21 09:43:59] .../lua/vim/lsp.lua:1392	"LSP[phpactor]"	"client.request"	1	"textDocument/hover"	{  position = {    character = 20,    line = 19  },  textDocument = {    uri = "file:///home/dmitri/sites/meg-worktree/feature/tests/Unit/ATest.php"  }}	<function 1>	1
[DEBUG][2023-08-21 09:43:59] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 3,  jsonrpc = "2.0",  method = "textDocument/hover",  params = {    position = {      character = 20,      line = 19    },    textDocument = {      uri = "file:///home/dmitri/sites/meg-worktree/feature/tests/Unit/ATest.php"    }  }}
[DEBUG][2023-08-21 09:43:59] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  id = 3,  jsonrpc = "2.0",  result = {    contents = {      kind = "markdown",      value = "### ATest # multipleLineComment\n\nThis is a\nmulti-line comment\n\n```php\n<?php public function multipleLineComment(): void\n```"    },    range = {      ["end"] = {        character = 39,        line = 19      },      start = {        character = 20,        line = 19      }    }  }}

PHPDoc support

I double checked if this feature is supported by phpdoc

From PhpDocumentor

A DocComment starts with a forward slash and two asterisks (/**), which is similar to how you start a multiline comment but with an additional asterisk, and ends with an asterisk and forward slash (*/). DocComments may be a single line in size but may also span multiple lines, in which case each line must start with an asterisk. It is customary, and recommended, to align the asterisks vertically when spanning multiple lines.

So, a single line DocComment looks like this:

/** This is a single line DocComment. */

And a multiline DocComment looks like this:

/**
 * This is a multi-line DocComment.
 */
@dantleech
Copy link
Collaborator

Syre, should be easy enough to add a failing test in the DocBlockParser package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants