zokugun / vscode-explicit-folding

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

Can this help me get invisible comments? #81

Closed icetbr closed 1 year ago

icetbr commented 2 years ago

Hi there, given this code

class A {
    /**
     * The Name
     */
    name,

    /** The Age  */
    age,
}

I want to get as close as possible to

class A {
    name,
    age,
}

I'd appreciate any ideas. Thanks.

daiyam commented 2 years ago

Try:

"explicitFolding.rules": {
    "*": [
        {
            "begin": "/*",
            "end": "*/",
            "nested": false,
            "kind": "comment",
        },
    ],
},

You will be able to fold as:

class A {
    /**
    name,

    /** The Age  */
    age,
}
icetbr commented 2 years ago

I can get this without the extension, it's VsCode's default behavior.

daiyam commented 2 years ago

There is no way to completely hide a block of code/comment.

icetbr commented 2 years ago

Maybe, but I can get pretty close, if only I could get the new line regexes right.

{
  "separator": ",",
},
class A {
  /**...
  name,...
  age,
}
icetbr commented 2 years ago

Another idea, if you desire to have this as a feature, just return the folding region as line -= 1. Then I would get something like this

class A {...
    name,...
    age,
}