zokugun / vscode-explicit-folding

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

ReadMe: language identifiers #103

Open TonyGravagno opened 1 year ago

TonyGravagno commented 1 year ago

HUGE thanks for this "quality of life" extension!

I was having a problem with setting explicitFolding.rules for the settings.json file itself. I want arrays to foldLastLine=true. Setting "begin": "[", "end": "]" for "*" had the desired effect, but not for "json". Looking at the VSCode docs I realized that this settings file is "JSON with Comments" = "jsonc", not just "json", and setting brackets for jsonc did the trick.

Please add a note in Readme.md or elsewhere to refer to https://code.visualstudio.com/docs/languages/identifiers for the list of supported languages (editorLangId). As other examples for those who wonder, this is where "javascriptreact" and "typescript" defined, and we see there that "scss" and "sass" are different types as well.

daiyam commented 1 year ago

Ya, that would be helpful with also the tip: You can see the language on the bottom right. When clicking on it, you get access to the language switcher which will show all the languages available with their identifier.

TonyGravagno commented 1 year ago

Oh yeah. I think that's better than the link, especially when there is a custom language that's implemented with an extension, and not mentioned in the default VSCode docs.

Kycko commented 7 months ago

Thank you @daiyam, I've added this code to my settings.json and it works for settings.json itself. Is there any method to use one code block for both identifiers (something like "javascript,snippets": [])?


    "explicitFolding.rules": {
        "javascript": [
            {
                "begin": "{",
                "end"  : "}"
            },
            {
                "begin": "`",
                "end"  : "`"
            },
            {"foldLastLine": true}
        ],
        "snippets": [
            {
                "begin": "{",
                "end"  : "}"
            },
            {
                "begin": "`",
                "end"  : "`"
            },
            {"foldLastLine": true}
        ]
    }