vscode-explicit-folding icon indicating copy to clipboard operation
vscode-explicit-folding copied to clipboard

ReadMe: language identifiers

Open TonyGravagno opened this issue 1 year ago • 3 comments

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.

TonyGravagno avatar Jun 08 '23 18:06 TonyGravagno

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.

daiyam avatar Jun 08 '23 18:06 daiyam

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.

TonyGravagno avatar Jun 08 '23 19:06 TonyGravagno

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}
        ]
    }

Kycko avatar Nov 27 '23 14:11 Kycko