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

@param fails to include multiline description #3083

Open
rhys-vdw opened this issue Feb 20, 2025 · 6 comments
Open

@param fails to include multiline description #3083

rhys-vdw opened this issue Feb 20, 2025 · 6 comments

Comments

@rhys-vdw
Copy link

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows WSL

What is the issue affecting?

Annotations

Expected Behaviour

Attributes should be correctly parsed when they wrap over multiple lines.

Actual Behaviour

In VSCode:

---@param foo integer This is a long description that wrongs over multiple lines
---but is misinterpreted.
function x(foo) end

Image

Image

---@param foo integer
---
---Long description with multiple paragraphs, and a code example:
---
---Usage:
---```lua
---local result = x(5)
---```
function x(foo) end

Image

Reproduction steps

Paste code above into VSCode.

Additional Notes

Surely it should be possible to write more than a single line of description for a parameter (and other tags).

Log File

No response

@CppCXY
Copy link
Collaborator

CppCXY commented Feb 20, 2025

I suggest you can try emmylua.

Image

@tomlau10
Copy link
Contributor

seems duplicated as #2333, which the root cause seems to be @param currently doesn't support multiline description

@rhys-vdw
Copy link
Author

seems duplicated as #2333, which the root cause seems to be @param currently doesn't support multiline description

That issue suggests that it does work in VSCode, and fails in NeoVim. Maybe this is a regression.

@tomlau10
Copy link
Contributor

tomlau10 commented Feb 21, 2025

That issue suggests that it does work in VSCode

Not really.
In additionally notes of that issue, you can see that although the extra line is rendered, but the font style is different.
=> that means the line might be just appended as an extra line in the result markdown, instead of being part of the param description
=> @param doesn't support multiline description


---@param foo integer
---
---Long description with multiple paragraphs, and a code example:
---
---Usage:
---```lua
---local result = x(5)
---```
---@param bar integer desc for param bar<br>this is correct new line rendering
local function x(foo, bar) end

Image

  • if no description in the same line as @param => nothing about this param will be shown
  • the middle part multi line description seems to be interpreted as function description, though the ordering is kept
    (rendered before the @param bar)
  • when using <br> to do line break in param description, you can clearly see that font style of both lines matches,
    and it is different than the font style of the middle part

edit: found a workaround

okay so here might be a workaround: adding a dummy # in the first line 😂
=> such that the first line is not empty

---@param foo integer #
---
---Long description with multiple paragraphs, and a code example:
---
---Usage:
---```lua
---local result = x(5)
---```
---@param bar integer desc for param bar<br>this is correct new line rendering
local function x(foo, bar) end

Image

edit2: opps... this renders fine when hovering the function, but not when hovering the param itself
=> still the mulitline part is not attached to the param itself

@MillhioreBT
Copy link

I suggest you can try emmylua.

Image

EmmyLua seems very solid and I like it, but it lacks hundreds of features that LuaLS has. That's the only thing currently stopping me from switching and using only EmmyLua.

@CppCXY
Copy link
Collaborator

CppCXY commented Feb 21, 2025

I suggest you can try emmylua.
Image

EmmyLua seems very solid and I like it, but it lacks hundreds of features that LuaLS has. That's the only thing currently stopping me from switching and using only EmmyLua.

It supports all annotations of luals and includes even more advanced features. Apart from missing some diagnostics, it can share all third-party libraries and is extremely fast—I don't see what else it could be lacking.

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

No branches or pull requests

4 participants