zokugun / vscode-explicit-folding

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

Folding breaks when both 'begin' and 'end' markers are on the same line #4

Closed HolyBlackCat closed 4 years ago

HolyBlackCat commented 5 years ago

How to reproduce:

Here's how the result looks like: 1

Now this might sound like an obscure thing to do, and it is, BUT...

Despite what the readme says, your extension seems to actually override/remove the builtin folding rules!
It means that in addition to custom rules I have to manually readd the basic curly brace folding: "begin":"{","end":"}". I'm fine with that, but in the language I'm working with {} on a single line is a common thing, which breaks your extension. :(

daiyam commented 5 years ago

@HolyBlackCat do make sure you have "editor.foldingStrategy": "auto". Which language are you using?

The folding markers are mostly meant to be used in a comment line (Emacs Folding Mode)

Here what I get in a JavaScript file: screenshot

HolyBlackCat commented 5 years ago

Yes, "editor.foldingStrategy" is set to "auto".

That's not a real language, just an example.

I get that behavior in a new unsaved file, without a language selected (status bar says Plain Text). The same problem persists in C++ files.

I'm not sure why it's different in JavaScript files, but even in those the third line of this snippet folds incorrectly:

1

markers are mostly meant to be used in a comment line

That was my original intention, but since the extension seems to prevent builtin folding rules for .cpp files from working (curly braces no longer fold), I needed to add {"begin":"\\{","end":"\\}"} rule as well, which breaks folding in a way similar to what I described above.

daiyam commented 5 years ago

@HolyBlackCat you are right there is an issue with c++ files.

yatian-liu commented 5 years ago

@daiyam Could you please try to fix this bug? Your extension is the only one I found in the VS Code markplace which can manually specify C/C++ folding marker, which is great for me, but this bug is a bit annoying when it occurs... Thank you!

daiyam commented 4 years ago

Hi @HolyBlackCat, it's very late but at last, it's fixed with 7ed6d0cc4e4d83b9a8a2a5b9ef43a9101a77bd29 (v0.4.0).