-
Notifications
You must be signed in to change notification settings - Fork 10
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
LSP now has a built-in request for this #7
Comments
Nice! I wonder how long would it take for servers to adopt it. |
rust-analyzer supports it, and I think typescript as well |
krobelus
added a commit
to krobelus/kakoune-lsp
that referenced
this issue
Dec 8, 2021
This adds support for selecting interesting ranges around cursors. Usually the ranges correspond to AST nodes. Add user-mode lsp-selection-range to quickly navigate the ranges. The VSCode UI is a bit different, it just needs Alt+Shift+{Left,Right}, whereas we need ":enter-user-mode lsp<ret>v" followed by j/k. We also allow to navigate outside the user mode using lsp-selection-range-select, but we don't yet have a way to automatically request ranges whenever we need them (like VSCode). We should try to do that, by simply requesting new ranges whenever the cursor positions are outside the cone of the previously fetched ranges. Backstory: I started looking into this feature because I found it[1] while trying to implement Kakuone text objects for functions and type definitions (generalizing lsp-next-symbol). Usually, <a-a>{ and }} are good enough but there are cases where they're not (like in Python buffers). It looks like this feature won't help much because it doesn't allow to filter out uninteresting ranges, but I guess it can be useful by itself. For function/type defintion text objects we just need to go back to our documentSymbol approach. We might still implement text objects for textDocument/selectionRange but it's probably not worth it, since the behavior is not always easy to predict, so the interactive user mode seems better. Closes kakoune-lsp#288 [1]: ul/kak-tree#7
krobelus
added a commit
to kakoune-lsp/kakoune-lsp
that referenced
this issue
Dec 8, 2021
This adds support for selecting interesting ranges around cursors. Usually the ranges correspond to AST nodes. Add user-mode lsp-selection-range to quickly navigate the ranges. The VSCode UI is a bit different, it just needs Alt+Shift+{Left,Right}, whereas we need ":enter-user-mode lsp<ret>v" followed by j/k. We also allow to navigate outside the user mode using lsp-selection-range-select, but we don't yet have a way to automatically request ranges whenever we need them (like VSCode). We should try to do that, by simply requesting new ranges whenever the cursor positions are outside the cone of the previously fetched ranges. Backstory: I started looking into this feature because I found it[1] while trying to implement Kakuone text objects for functions and type definitions (generalizing lsp-next-symbol). Usually, <a-a>{ and }} are good enough but there are cases where they're not (like in Python buffers). It looks like this feature won't help much because it doesn't allow to filter out uninteresting ranges, but I guess it can be useful by itself. For function/type defintion text objects we just need to go back to our documentSymbol approach. We might still implement text objects for textDocument/selectionRange but it's probably not worth it, since the behavior is not always easy to predict, so the interactive user mode seems better. Closes #288 [1]: ul/kak-tree#7
topisani
pushed a commit
to kakoune-lsp/kakoune-lsp
that referenced
this issue
Dec 15, 2021
This adds support for selecting interesting ranges around cursors. Usually the ranges correspond to AST nodes. Add user-mode lsp-selection-range to quickly navigate the ranges. The VSCode UI is a bit different, it just needs Alt+Shift+{Left,Right}, whereas we need ":enter-user-mode lsp<ret>v" followed by j/k. We also allow to navigate outside the user mode using lsp-selection-range-select, but we don't yet have a way to automatically request ranges whenever we need them (like VSCode). We should try to do that, by simply requesting new ranges whenever the cursor positions are outside the cone of the previously fetched ranges. Backstory: I started looking into this feature because I found it[1] while trying to implement Kakuone text objects for functions and type definitions (generalizing lsp-next-symbol). Usually, <a-a>{ and }} are good enough but there are cases where they're not (like in Python buffers). It looks like this feature won't help much because it doesn't allow to filter out uninteresting ranges, but I guess it can be useful by itself. For function/type defintion text objects we just need to go back to our documentSymbol approach. We might still implement text objects for textDocument/selectionRange but it's probably not worth it, since the behavior is not always easy to predict, so the interactive user mode seems better. Closes #288 [1]: ul/kak-tree#7
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See emacs-lsp/lsp-mode#817 :-)
The text was updated successfully, but these errors were encountered: