Skip to content

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

@Orion351

Description

@Orion351

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 :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions