Skip to content

Commit

Permalink
Fix folding range bug in C# extension (#69817)
Browse files Browse the repository at this point in the history
* fix folding range bug

* feedback

* folding range works for regions now
  • Loading branch information
akhera99 authored Sep 13, 2023
1 parent 54a85bc commit 0d61377
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,15 @@ public FoldingRangesHandler(IGlobalOptionService globalOptions)
if (document is null)
return null;

var options = _globalOptions.GetBlockStructureOptions(document.Project);
var options = _globalOptions.GetBlockStructureOptions(document.Project) with
{
// Need to set the block structure guide options to true since the concept does not exist in vscode
// but we still want to categorize them as the correct BlockType.
ShowBlockStructureGuidesForCommentsAndPreprocessorRegions = true,
ShowBlockStructureGuidesForDeclarationLevelConstructs = true,
ShowBlockStructureGuidesForCodeLevelConstructs = true
};

return await GetFoldingRangesAsync(document, options, cancellationToken).ConfigureAwait(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public async Task TestGetFoldingRangeAsync_Comments(bool mutatingLspWorkspace)
AssertJsonEquals(expected, results);
}

[Theory(Skip = "GetFoldingRangeAsync does not yet support regions."), CombinatorialData]
[Theory, CombinatorialData]
public async Task TestGetFoldingRangeAsync_Regions(bool mutatingLspWorkspace)
{
var markup =
Expand Down

0 comments on commit 0d61377

Please sign in to comment.