LuaLS / LuaLS/lua-language-server
Collapsing of functions in the editor breaks if there is a comment before and after the function declaration
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
VSCode with sumneko.lua 3.7.4
Reproducer:
```
-- foo
function foo() -- foo
if a then
return a
end
end
```
This code shows two collapsing/folding indicators to the left, one for the if (expected) and one for the comment (unexpected), but none for the function itself:

Clicking the first folding icon results in this:

It looks like it thinks the two comments belong to one comment block for the function instead of being unrelated comments.
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 in VSCode with the supplied Lua example and compare the indicators around the comments, function, and if block. Done means the comments remain separate and the function receives its expected folding indicator without breaking the if folding behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, vscode
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100