zokugun / vscode-explicit-folding

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

additionalSchemes not working #114

Closed mDeSimone-DFactorySrl closed 2 months ago

mDeSimone-DFactorySrl commented 2 months ago

Describe the issue

i am trying to add an additional scheme with "begin": "{/", "end": "/}" but in my .tsx file seems not working

To reproduce

Code Example

{/* #region Test */}
<Text>Random Text</Text>
{/* #endregion */}

Settings

"editor.showFoldingControls": "always",
    "explicitFolding.rules": {
        "*": {
            "begin": "{/*",
            "end": "*/}"
        }
    },
daiyam commented 2 months ago

In general, VSCode doesn't support single line folding. Same for this extension. (Since it provides only the ranges and doesn't change the UI behavior)

daiyam commented 2 months ago

Maybe you should try:


"explicitFolding.rules": {
        "*": {
            "begin": "#region",
            "end": "#endregion"
        }
    },
mDeSimone-DFactorySrl commented 2 months ago

In general, VSCode doesn't support single line folding. Same for this extension. (Since it provides only the ranges and doesn't change the UI behavior)

Even with multiple line is it not working `{/ #region Test /}

Random Text Random Text 2

{/ #endregion /} `

If i use // #region // #endregion Is it working but this are not "comment" in typescript

daiyam commented 2 months ago

Is it working but this are not "comment" in typescript

You need to add "kind": "comment" to the rule (https://github.com/zokugun/vscode-explicit-folding/blob/master/docs/rules/begin-end.md#kind)

Even with multiple line is it not working

The {/* / */} can be problematic since they can be matched by the TS language provider (as comment blocks) and generate conflicts. VSCode gets 2 set of ranges and merge them as it wants.

You might try to use "editor.defaultFoldingRangeProvider": "zokugun.explicit-folding", but it disables the language provider...

mDeSimone-DFactorySrl commented 2 months ago

Is it working but this are not "comment" in typescript

You need to add "kind": "comment" to the rule (https://github.com/zokugun/vscode-explicit-folding/blob/master/docs/rules/begin-end.md#kind)

Even with multiple line is it not working

The {/* / */} can be problematic since they can be matched by the TS language provider (as comment blocks) and generate conflicts. VSCode gets 2 set of ranges and merge them as it wants.

You might try to use "editor.defaultFoldingRangeProvider": "zokugun.explicit-folding", but it disables the language provider...

unfortunately it is still not working with those settings.

I have managed, thanks to copilot, to make it working adding in settings.json this

"explicitFolding.rules": {
        "typescriptreact": {
            "begin": "{/* #region */}",
            "end": "{/* #endregion */}"
        },
        "javascriptreact": {
            "begin": "{/* #region */}",
            "end": "{/* #endregion */}"
        }
    }