[LSP] Re-enable folding range provider#49070
Conversation
| 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.
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
dibarbet
left a comment
There was a problem hiding this comment.
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
dibarbet
left a comment
There was a problem hiding this comment.
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.
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.
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/).