Skip to content
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

Open
matklad opened this issue May 5, 2019 · 2 comments
Open

LSP now has a built-in request for this #7

matklad opened this issue May 5, 2019 · 2 comments

Comments

@matklad
Copy link

matklad commented May 5, 2019

See emacs-lsp/lsp-mode#817 :-)

@ul
Copy link
Owner

ul commented May 5, 2019

Nice! I wonder how long would it take for servers to adopt it.

@matklad
Copy link
Author

matklad commented May 5, 2019

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants