-
Notifications
You must be signed in to change notification settings - Fork 511
Still having problems with Regions folding on 1.8.2 #1458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @MayPLaY, I've watched through the GIF a couple of times, but just want to be clear about the behaviour you're seeing vs the behaviour you're expecting. Can you restate, in words, (1) the behaviour you're expecting and (2) the behaviour you're experiencing that differs from that expectation? Also worth noting that this folding feature can be disabled with:
|
Sorry for the confusion. Expected
What it does
I hope it's a bit more clear :). Thanks. |
@glennsarti for the awareness. I think we currently mark a lot of these folds as Region ... Except for As a test... Does the "Un/Fold All Regions" fold block comments |
@MayPLaY for the notification just in case |
This seems like expected behaviour.
There are only 3 types of folding types (https://code.visualstudio.com/docs/extensionAPI/vscode-api#FoldingRangeKind) |
Yeah, Glenn's right. I think we should probably open an issue on vscode to add another item to the enum... Maybe like a "Code" FoldingRangeKind |
I haven't tried using an invalid enum integer e.g. -1 |
Wait, we're depending on VSCode to work out what to do based on the value, so we need a new enum value... |
Okay...so quick test, it does work. With an ID that is not in the enum, it doesn't respond to Unfold/Fold all Regions or Block Comments, BUT it still responsed to Unfold/Fold All. Can't say I'm happy about it though. It's definitely a hack Changed the following From: // Find matching comment regions #region -> #endregion
this.matchScopeElements(
this.extractRegionScopeElements(tokens, document),
"custom.start.region",
"custom.end.region",
vscode.FoldingRangeKind.Region, document)
.forEach((match) => { matchedTokens.push(match); }); To // Find matching comment regions #region -> #endregion
this.matchScopeElements(
this.extractRegionScopeElements(tokens, document),
"custom.start.region",
"custom.end.region",
56, document)
.forEach((match) => { matchedTokens.push(match); }); |
Ok. Let's maybe have a const static variable called like Then we can have the expected behavior at least. |
Wow, issue 55,686! |
To quote from the VSCode issue:
|
Nice find, Rob! |
OKay, I sense another PR on the way |
... And it's already done. microsoft/vscode@dea3960 |
Previously all of the folding ranges were either Region or Comment, however this is confusing e.g. a Here String is neither a region or a comment. The VS Code API does state that the range kind property is optional. This commit changes the range kind for braces, parentheses and here strings to be null, that is, neither a region or comment range. This makes editor commands like 'Fold All Regions' behave as a user expects.
Previously all of the folding ranges were either Region or Comment, however this is confusing e.g. a Here String is neither a region or a comment. The VS Code API does state that the range kind property is optional. This commit changes the range kind for braces, parentheses and here strings to be null, that is, neither a region or comment range. This makes editor commands like 'Fold All Regions' behave as a user expects.
Fix PR is up - #1467 |
Thanks @glennsarti |
Previously all of the folding ranges were either Region or Comment, however this is confusing e.g. a Here String is neither a region or a comment. The VS Code API does state that the range kind property is optional. This commit changes the range kind for braces, parentheses and here strings to be null, that is, neither a region or comment range. This makes editor commands like 'Fold All Regions' behave as a user expects.
Issue Description
Hi,
I saw with 1.8.0/1.8.1 you guys had some problems with regions folding, and 1.8.2 was supposed to fix it. But as you see in this gif, I'm still having problems with everything getting folded instead of my designed regions.
I'm using "ctrl+k ctrl+8" and "ctrl+k ctrl+9" to fold/unfold. With the extentsion installed, I'm having trouble, but without it, I got no problem at all. I can't recall I moment where it didn't work before 1.8.x.
Thanks !!
Environment Information
Visual Studio Code
PowerShell Information
Visual Studio Code Extensions
Visual Studio Code Extensions(Click to Expand)
The text was updated successfully, but these errors were encountered: