Skip to content

Feature Request: folding multiline method signatures #80946

@lonix1

Description

@lonix1

BACKGROUND

Consider this mega constructor/method:

   public Foo(        // <--- not foldable
     bool foo,
     bool bar,
     bool baz,
     string qux,
     string quux,
     string corge,
     int grault,
     int garply,
     int waldo,
     double fred,
     double plugh,
     double xyzzy,
     float thud,
     // ...
v ) {                 // <--- foldable
     // ...
   }

Notice how the folding caret allows folding of the body. It would be very helpful if we could also fold the signature.

PROBLEM

Now, before someone mentions the inevitable "You shouldn't have God Objects or mega signatures in your codebase", please note that in large, complex, real-world codebases, this is not abnormal. Imagine construction of a "product" or "person" or similar, in a large complex system... large signatures will occur. Especially in a DDD codebase where objects must be "always valid", there is very little to no "eventual consistency" construction - so large signatures are normal. Those classes are terribly difficult to handle: not because they're poorly coded but rather because they're not "readable".

SOLUTION

I can't remember which language I was using (also in vscode) where for multiline signatures, the signature and body were foldable (separately). So I imagine it's possible.

Please consider adding support for this scenario? If hidden behind a setting that would be fine too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions