zokugun / vscode-explicit-folding

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

Set multiple folding providers? #106

Open paul-uz opened 1 year ago

paul-uz commented 1 year ago

If I set my default folding provider to zokugun.explicit-folding then the typical folding available in YML files is removed.

How can I keep the default folding for YML files, but also include this provider, for my custom rules?

daiyam commented 1 year ago

Don't set editor.defaultFoldingRangeProvider. "editor.foldingStrategy": "auto" will use all the folding providers availables.

paul-uz commented 1 year ago

Docs need updating then, as they explicitly state to set

"editor.foldingStrategy": "auto",
"editor.defaultFoldingRangeProvider": "zokugun.explicit-folding",

in your settings.

TonyGravagno commented 1 year ago

This is helpful. I toggled from default to zokugun and have spent a lot of time completely replacing common fold rules like (-) and {-} and .

It will be much better to simply augment the default to do what it does not do.

The question then arises : Which rules have priority if there is a conflict? The first? The last? The more specific? And can we control that?

daiyam commented 1 year ago

The question then arises : Which rules have priority if there is a conflict? The first? The last? The more specific? And can we control that?

Kinda. This extensions provides to VSCode the list of possibles folding ranges and then it select which one to display. But when not using editor.defaultFoldingRangeProvider, the setting explicitFolding.delay can control (more a hack) which providers VSCode is prioritizing. With "explicitFolding.delay": 0,, VSCode will prioritize the built-in provider. With "explicitFolding.delay": 1000,, VSCode will prioritize the extension. But that causing the issue of not remembering the folding status (opened or closed) when reopening a file.

Even with editor.defaultFoldingRangeProvider, I found out that sometime VSCode won't respect it. I need to reload the editor to make it to use it correctly.

TonyGravagno commented 1 year ago

I see what you're doing there. Not to be too technical but yeah, I had to jiggle some wires to get this block to foldLastLine on line 6.

230628174513

I'd be more specific but I tinkered with this for a while, used Reload Window, closed and re-opened the application... it's not obvious what gets it to allow the extension override.

At this moment, as seen above, I do have an override after setting and then disabling explicitFolding.delay. But there's no telling what might happen after a system restart.

I'm not complaining - I understand that we're working at a different level here and appreciate what this extension is doing for us.

Thanks for the support!