LuaLS / lua-language-server

A language server that offers Lua language support - programmed in Lua
https://luals.github.io
MIT License
3.26k stars 306 forks source link

Additional blank lines are added to parameter descriptions in type annotations #2333

Open MariaSolOs opened 1 year ago

MariaSolOs commented 1 year ago

How are you using the lua-language-server?

NeoVim

Which OS are you using?

MacOS

What is the issue affecting?

Hover

Expected Behaviour

For multiline descriptions in @param annotations to be displayed as if they were in a single line.

Actual Behaviour

When the description in a @param annotation spans multiple lines, a linebreak in inserted in the Markdown response, which breaks syntax highlighting:

image

Even after removing the preceding whitespace in the example above, formatting is still off:

image

Reproduction steps

  1. Create a lua file with the following content:
    ---@param bar any This is the description
    ---           for bar.
    local function foo(bar) end
  2. Hover over foo.
  3. Notice the broken highlighting/formatting in the description of bar.

Additional Notes

Although VS Code doesn't have additional syntax highlighting, do note how the font style in explanation above) changes, which suggests that the issue is reproducible outside Neovim:

image

Log File

No response

wookayin commented 8 months ago

This is mostly like because Lua-LS or LuaCATS can't recognize multi-line string for @param. When hovered on the parameter bar, the docstring for the parameter will be "This is the description" (without foo bar).

It'd be great if multi-line strings can be supported for @param desc -- because in some cases the description can be quite long. @sumneko Would this be possible?