zokugun / vscode-explicit-folding

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

Question: Python #36

Closed OSHI7 closed 3 years ago

OSHI7 commented 3 years ago

I'm trying to figure out how to use this to improve code-folding in python cells, in particular. Cells are not recognized, so I add this capability,

via "folding":{ "*":[ { "separator": "#%%", "nested" : true }, ], }

But then I lose all the built-ins (if/when,etc). Is there any way I can generate? I get stuck with the 'if', because in python there is no 'end' statement to close on. I tried variants making that a separator, but that was a baad idea. I tried adding regex with 2 new lines at the end of the if block, but I was unable to figure this out. { "begin": "iff", "endregex" : "^\n\n", } , Any hints? Can I keep the built-in folding imperatives? Can I copy them in from somewhere?

daiyam commented 3 years ago

The python foldings are provided by the default indentation provider which is used when no provider are found. So when you are using the current extension, you are give it a provider so the indentation provider isn't used.

Th current work around is the use my version of VSCode (MrCode) with the setting "editor.foldingStrategy": "explicit & indentation". It will give you the foldings from both providers.

OSHI7 commented 3 years ago

Ok, interesting! Thank you!

daiyam commented 3 years ago

@OSHI7 Your issue is a duplicate of the issue #27. I'm working on a solution so please refer to that issue. Thx