From d7bdd19873b2a6fc8185a00b3b680a27b30bc78d Mon Sep 17 00:00:00 2001 From: akhera99 Date: Tue, 5 Sep 2023 11:25:08 -0700 Subject: [PATCH 1/3] fix folding range bug --- .../Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs b/src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs index e211bc1ad7b54..8347415f75bef 100644 --- a/src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs @@ -41,7 +41,11 @@ public FoldingRangesHandler(IGlobalOptionService globalOptions) if (document is null) return null; - var options = _globalOptions.GetBlockStructureOptions(document.Project); + var options = _globalOptions.GetBlockStructureOptions(document.Project) with + { + ShowBlockStructureGuidesForCommentsAndPreprocessorRegions = true + }; + return await GetFoldingRangesAsync(document, options, cancellationToken).ConfigureAwait(false); } From 1b5a42e9673bc5ac4c09896dd7c323156654a78e Mon Sep 17 00:00:00 2001 From: akhera99 Date: Thu, 7 Sep 2023 15:13:23 -0700 Subject: [PATCH 2/3] feedback --- .../Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs b/src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs index 8347415f75bef..50b7dc2b0c304 100644 --- a/src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs @@ -43,7 +43,11 @@ public FoldingRangesHandler(IGlobalOptionService globalOptions) var options = _globalOptions.GetBlockStructureOptions(document.Project) with { - ShowBlockStructureGuidesForCommentsAndPreprocessorRegions = true + // 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); From be76882903068115bb0a39f5dc0a6d17c76fbbfc Mon Sep 17 00:00:00 2001 From: akhera99 Date: Wed, 13 Sep 2023 12:49:00 -0700 Subject: [PATCH 3/3] folding range works for regions now --- .../ProtocolUnitTests/FoldingRanges/FoldingRangesTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/LanguageServer/ProtocolUnitTests/FoldingRanges/FoldingRangesTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/FoldingRanges/FoldingRangesTests.cs index 1e2cfcc2651ca..d994b0aabdf56 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/FoldingRanges/FoldingRangesTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/FoldingRanges/FoldingRangesTests.cs @@ -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 =