-
Notifications
You must be signed in to change notification settings - Fork 126
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
[Folding ranges]: support more AST nodes #692
[Folding ranges]: support more AST nodes #692
Conversation
34d942c
to
c44b883
Compare
I tried to identify more use cases where folding would make sense (together with some tests to cover them). Hopefully it does make sense. |
@ulugbekna could you take over reviewing this PR? I don't have time to look closely |
@rgrinberg sure |
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.
LGTM, thanks @tatchi ! :-)
bafc7c9
to
84b45de
Compare
Ready to be merged as soon as CI runs re: more visual tests I'm all for it. Maybe we could have something like this, ie we use IDs to see start and end of folds:
What vscode does is also cool |
Can we squash the commits before mergin? |
CHANGES: ## Features - Fix cancellation mechanism for all requests (ocaml/ocaml-lsp#707) - Allow cancellation of formatting requests (ocaml/ocaml-lsp#707) - Add `--fallback-read-dot-merlin` to the LSP Server (ocaml/ocaml-lsp#705). If `ocamllsp` is started with this new flag, it will fall back to looking for Merlin configuration in `.merlin` files rather than calling `dune ocaml-merlin`. (ocaml/ocaml-lsp#705) - Support folding more ranges (ocaml/ocaml-lsp#692)
I'm wondering if we couldn't improve the result of these tests to be more visual. We could try indicates the locations directly on the code block itself.
So given the following code:
With the produced locations:
We could produce:
The problem is that we only see the
startLine
but not theendLine
.Another option might be to copy what vscode does: https://github.com/microsoft/vscode/blob/main/extensions/html-language-features/server/src/test/folding.test.ts#L42
It doesn't use snapshot testing but manually assert on what should be the {start,end}Line. A comment with the line number is also added to the code snippet.
@rgrinberg any thoughts ?