LuaLS / LuaLS/lua-language-server
Incorrect folding range when a function with an inline comment follows an annotation
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
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.
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.
Log File
I couldn't get the thing to upload it, I'm sorry :(
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the folding behavior with the Lua snippet in the issue, comparing it with the variants that remove the inline comment or add a blank line. Trace the folding-range handling for an annotation followed by a function declaration. Done means the folding chevron is beside the function declaration and folds the entire function body.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100