lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

Incorrect folding range when a function with an inline comment follows an annotation

Open Orion351 opened this issue 6 months ago • 1 comments

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Formatting

Expected Behaviour

The folding chevron will be next to the function declaration and will fold the function.

Actual Behaviour

The folding chevron is next to the annotation and will only fold the one line of the function, leaving the rest of the function unfolded.

Image Image

Reproduction steps

This code reproduces it: ---@param bar integer function foo(bar) -- comment local whee = bar + 3 return whee end

Additional Notes

Removing the inline comment fixes it. Putting a blank line between the annotation and the function declaration line, even if it still has the inline comment, fixes it.

Image Image

Log File

I couldn't get the thing to upload it, I'm sorry :(

Orion351 avatar Jul 03 '25 14:07 Orion351