Skip to content

Improve code folding for decorators #2861

@Geo5

Description

@Geo5

Summary

Hi, thank you for the work!
I noticed some potential improvements for the (very) recently implemented code folding (#2588) regarding function decorators:
ty currently only creates one fold including the decorator(s) and the function, which leads to this:

class Foo:
    @staticmethod
    def bar(arg: int) -> None:
        pass
Image

Which i think is not the best possible experience, because it hides the actual function name.

If i disable language services, the native VSCode folding looks like this, with 2 levels of folding for decorators and the function itself:

Image Image

Which i like more, because i can see function names without unfolding the implementation. I think there could also be an argument for not creating a fold for the decorators at all, or at least not if there is only one decorator, but i am not sure what i would like best there.

Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedContributions especially welcomeserverRelated to the LSP server

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions