-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
[LSP] Re-enable folding range provider #49070
Conversation
@@ -58,11 +58,17 @@ public async Task<FoldingRange[]> HandleRequestAsync(FoldingRangeParams request, | |||
|
|||
var linePositionSpan = text.Lines.GetLinePositionSpan(span.TextSpan); | |||
|
|||
// Filter out single line spans. | |||
if (linePositionSpan.Start.Line == linePositionSpan.End.Line) |
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 added this check to match local Roslyn, which filters out single-line regions.
src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.cs
Outdated
Show resolved
Hide resolved
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.
are there existing tests for the folding ranges handler? If not we should add them
src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.cs
Outdated
Show resolved
Hide resolved
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.
only request would be to unify the checks into an extension method on document
src/EditorFeatures/Core.Wpf/Structure/AbstractStructureTaggerProvider.cs
Outdated
Show resolved
Hide resolved
@dibarbet There are some existing tests, it looks like some are disabled though. The disabled tests pass if |
{ | ||
internal static class DocumentExtensions | ||
{ | ||
public static bool IsInCloudEnvironmentClientContext(this Document document) |
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.
could this go in one of the existing ones?
maybe http://sourceroslyn.io/#Microsoft.CodeAnalysis.Workspaces/DocumentExtensions.cs,c73098348ffcde85
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 tried the existing ones - it looks like either IWorkspaceContextService isn't available in the layer (like the one you linked above), or the particular DocumentExtensions isn't accessible from the callsites :/
Fixes #48600
The folding range provider already existed, but wasn't enabled. Roslyn on the client was providing folding ranges instead (now disabled).
For the most part, everything looks to be working properly. I found one bug involving regions at the end of files that crashes folding ranges, but I believe it's an LSP issue (filed https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1240541/).