-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Also checking line end when block structure is filtered #74413
Conversation
Can you show a picture showing how the user experience has changed? Thanks! |
Editing now... |
@@ -72,6 +72,7 @@ public async Task IdentifierThatLooksLikeCode() | |||
|
|||
await VerifyBlockSpansAsync(code, | |||
Region("textspan3", "/* now everything is commented (); ...", autoCollapse: true), | |||
Region("textspan2", "hint2", CSharpStructureHelpers.Ellipsis, autoCollapse: false), |
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.
Reset this to its prev state: see https://github.com/dotnet/roslyn/pull/71064/files#diff-0fd1ed24f6843351146536bd47576962e5ff059c6a5834075c2d7beef4b50cbc
Also checking line end when block structure is filtered
Also checking line end when block structure is filtered
Also checking line end when block structure is filtered
Fix https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2094051
Reason:
In PR #71064, it introduced a trick to only fold the inner method2 in this case:
Method1
's block is skipped because it has the same start line asMethod2
However this introduce problem because in this case
In VB, we first provide the block structure of
If
, also we provide the block structure forfoo
because it is a string literal https://github.com/dotnet/roslyn/blob/release/dev17.10/src/Features/CSharp/Portable/Structure/Providers/StringLiteralExpressionStructureProvider.csBecause
foo
and If statement both have the same start line,If
statement is removed from the block structure span.Later, because
foo
's structure is removed because its start line and end line are same.roslyn/src/EditorFeatures/Core/Structure/AbstractStructureTaggerProvider.cs
Line 263 in fa643d6
Fix:
Instead of only checking for the start line, also check the end line when trying to remove the block. It should still work for case
the block structure of
Method1
would still be removed. and it's safer when dealing with other cases.Before:
After: