feat(expert): support folding ranges#649
Conversation
|
I'll give this a proper review tomorrow, but there's also #36 which is a draft I started last year to see how hard it'd be to port this feature from ElixirLS, you might want to take a look to see if we're covering all the cases |
|
shouldn't |
|
@doorgan I did not see the other PR, sorry! From the brief analysis, I think the scope of the other one is much bigger. I was mostly after what the extension currently does. So my solution does not fold, for example:
So if you like, we can instead try to get your PR to mergeable state. I'm not sure about this licensing thing mentioned there though. @RedCMD not sure I understand. For now the server does not provide any folding guidance so the editors might do it on their own, either from an Expert extension (VSCode) or by other means, like tree sitter. |
|
my bad might make a report on it |
|
@RedCMD from my tests yesterday it looked like
Not an expert here, just what I observed while investigating the issue with folding. |
|
would be these definitions
|
doorgan
left a comment
There was a problem hiding this comment.
Works well for what it implements and code looks good
We can add the missing features from #36 in a separate PR. The old one exists because I was testing how hard would it be to port ElixirLS features to Expert(not that hard tbh) but I deprioritized to follow the milestones roadmap. Feel free to take over or reimplement it though.
The licensing comments in that PR are because I mostly copy-pasted ElixirLS implementation, and that warrants attribution
|
Please update the tracking issue with any further enhancements that need to be added before closing. |
|
Updated #146 |
c050a7e to
fb90a43
Compare
fb90a43 to
4e56162
Compare
|
Please update the website with this new feature |
While attempting to address expert-lsp/vscode-expert#45 I realized that while we can fix the particular issue that was reported, we can't really have reliable folding based on what VSCode offers (which is basically regexes to determine start of the fold and end of the fold). For example, this will always be problematic:
In this example there's no way to tell if
"""is opening or closing, using just regexes.That lead me to investigate foldingRange request in LSP spec. I realized that it's much more fitting for Elixir, probably, and decided to try to implement it.
It works pretty well in my tests and VSCode automatically picks this up when the server advertises its capabilities of defining the ranges. I haven't checked other editors yet though.