Vscode: [folding] allow defining folding regions in user settings and/or extensions

Created on 10 Oct 2017  路  8Comments  路  Source: microsoft/vscode

Would it be able to abstract out the language specifics and treat code folding similar to how emmet handles it...
i.e.

    "emmet.includeLanguages": {
        "php": "html",
        "blade": "html",
        "javascript": "javascriptreact"
    },

So for code folding it could be...

    "codeFolding.IncludeLanguages": {
        "php": {
            "openTag": "//#region",
            "closeTage": "//#endregion"
        },
        ...etc...
    }

This is just an off the cuff idea for implementing this and I'm not sure that it's possible, but the goal would be to not be dependent on the language plugin developers to implement the feature.

editor-folding feature-request

Most helpful comment

This is a sort of +1 comment. Please expose these settings directly in the user settings so that we don't have to go mucking about with PRs for each and every language.

See also my comment from the Vim issue. Ideally there would also be a catch-all folding marker for all the files that don't necessarily have a plugin, so that you can still get folding even if VS Code does not have explicit support for the specific file type.

Something like:

"codeFolding.IncludeLanguages": {
        "*": {  // Maybe use "any" or "all" instead of just "*" as the wildcard?
            "openTag": "//#region",
            "closeTag": "//#endregion"
        },
        ...etc...
 }

This helps with the use case of using VS Code as a generic editor, a replacement for Notepad++, Sublime Text, Vim, etc.

All 8 comments

@ramya-rao-a this isn't actually emmet related. Emmet was noted simply to be an implementation option to reference.

Thanks @jm-mwi. I have updated the labels accordingly

@jm-mwi The configuration of the folding markers is already language specific, in the language's 'language-configuration' file. But its not part of the user settings yet.

Is it possible to add to javascript-language-configuration.json the "editor-fold" tag ?

"folding": {
    "markers": {
        "start": "^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))",
        "end": "^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))"
    }
}

@Ptiloup Sure, please create a PR or a new issue!

This is a sort of +1 comment. Please expose these settings directly in the user settings so that we don't have to go mucking about with PRs for each and every language.

See also my comment from the Vim issue. Ideally there would also be a catch-all folding marker for all the files that don't necessarily have a plugin, so that you can still get folding even if VS Code does not have explicit support for the specific file type.

Something like:

"codeFolding.IncludeLanguages": {
        "*": {  // Maybe use "any" or "all" instead of just "*" as the wildcard?
            "openTag": "//#region",
            "closeTag": "//#endregion"
        },
        ...etc...
 }

This helps with the use case of using VS Code as a generic editor, a replacement for Notepad++, Sublime Text, Vim, etc.

@costincaraivan To vote for a feature please add a 馃憤 to the description

Hi,

I've done a quick experimental extension to add custom folding: Zokugun Folding.
The main problem is that I can't remove the existing folding so you get 2 folding providers...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DovydasNavickas picture DovydasNavickas  路  3Comments

sirius1024 picture sirius1024  路  3Comments

omidgolparvar picture omidgolparvar  路  3Comments

mrkiley picture mrkiley  路  3Comments

borekb picture borekb  路  3Comments