Fix code-folding for LSP clients that support line-folding only#7750
Fix code-folding for LSP clients that support line-folding only#7750lahodaj merged 1 commit intoapache:masterfrom
Conversation
|
On a (relatively) quick review, this seems OK to me. But, I would say the |
Thanks @lahodaj for taking a quick look at this draft PR. I intended to add the unit tests before making it ready-for-review. :) |
1. Added `TextDocumentServiceImpl.convertToLineOnlyFolds` which:
- accepts code-folds specified as fine-grained Position-based (line, column) ranges, and,
- changes them to coarse-grained line-only ranges.
- The line-only ranges computed uphold the code-folding invariant that: *a fold **does not end** at the same point **where** another fold **starts**. *
2. This is used in `TextDocumentServiceImpl.foldingRange()` when the client capabilities have `FoldingRangeClientCapabilities.lineFoldingOnly = true`.
Signed-off-by: Siddharth Srinivasan <siddharth.srinivasan@oracle.com>
e914d3a to
d371a8c
Compare
|
I added the unit test for this enhancement. @lahodaj - Please review whenever you get a chance. Thank you. |
|
@lahodaj Request you to please facilitate in reviewing this PR. Thank you. |
Thank you very much. |
|
Unless there are objections, I'll merge tonight. |
…ation Added the backport of the Netbeans PR apache/netbeans#7750 patch which allows supporting LSP clients which have line-only folding support. - This is the case of VS Code as referenced in microsoft/vscode#50840. Closes oracle#249 Signed-off-by: Siddharth Srinivasan <siddharth.srinivasan@oracle.com>
|
The LSP I was trying to look to this PR's github workflow actions but could not find it. I am not sure why the github actions didn't run on the PR. I am very sorry for this unit tests breakage. I will need to add the following fix to TextDocumentServiceImpl |
|
How about this: |
|
Thank you very much @lahodaj. |
I am also not completely sure what happened here. But it looks like the last change to this branch was about a month ago, and github didn't add the green check mark there. This could mean that the CI-run was waiting to be approved for this PR and nobody pressed the button? But this is just a guess - could be something else. here our PR review / merge check list as reminder: in particular:
|

Added
TextDocumentServiceImpl.convertToLineOnlyFoldswhich:This is used in
TextDocumentServiceImpl.foldingRange()when the client capabilities haveFoldingRangeClientCapabilities.lineFoldingOnly = true.Symptoms of this issue maybe seen in oracle/javavscode#249.