-
Notifications
You must be signed in to change notification settings - Fork 177
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
Region folding. Fix Microsoft/vscode#46591 #84
Conversation
src/services/cssFolding.ts
Outdated
@@ -92,6 +93,44 @@ export function getFoldingRegions(document: TextDocument): FoldingRangeList { | |||
* All comments are marked as `Comment` | |||
*/ | |||
case TokenType.Comment: { | |||
// CSS region folding | |||
if (token.text === '/* #region */') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a regexp here to allow any number of whitespaces and a description after the 'region'.
assertRanges(input, [r(0, 4, 'region'), r(1, 2)]); | ||
}); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add some tests with incorrect nesting, e.g. the
/* #region */
& .bar {
/* #endregion */
}
The region should win...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by "should win"? Currently this outputs (0, 2) and (1, 2) regions. Is that not the expected result?
I'll just merge what I have in and feel free to open another issue for this one, if this is not what you are expecting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regions can not intersect. Maybe look at this example:
/* #region */
.bar {
/* #endregion */
// hello
}
[0,2] and [1,3] would be illegal.
-> once you see the /* #endregion */,
discard all open ranges until you see the open /* #region */
. The extected result is [0,2]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, will open a new issue to track this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created #85.
No description provided.