zokugun / vscode-explicit-folding

Customize your Folding for Visual Studio Code
MIT License
95 stars 14 forks source link

Idea: A way to fold the *first* line, in similar to `"foldLastLine": true`. #95

Open HolyBlackCat opened 1 year ago

HolyBlackCat commented 1 year ago

Let's say I have this rule:

{
    "begin": "{",
    "end": "}",
}

If I apply it to:

void foo()
{
    //
}

It folds to:

void foo()
{ …

I can show or hide } using "foldLastLine", but there's currently no way to show/hide the {. I.e. no way to fold that to:

void foo() …

I think it would be nice to have something like "foldFirstLine", which moves the start of the fold one line up.

I'd then create two rules: one that matches a line that has nothing but { and whitespace ("foldFirstLine": true), and the fallback one that matches { elsewhere (false).