-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Incoming call's hierarchy item's range is not usable as a point from which to start a new call hierarchy #17388
Comments
The lsp docs on the /**
* The range enclosing this symbol not including leading/trailing whitespace
* but everything else, e.g. comments and code.
*/ which implies to me that we are doing everything correctly here. Notably though, there is the /**
* The range that should be selected and revealed when this symbol is being
* picked, e.g. the name of a function. Must be contained by the
* [`range`](#CallHierarchyItem.range).
*/ it feels like this is what you ought to be using here for this kind of logic instead? |
I have definitely overlooked For what it's worth, here's what happened with different servers:
|
|
I am not sure if this should be a bug report or a feature request.
I have implemented call hierarchies in my client and only rust-analyzer is behaving counter to my expectations.
With the above file, here's what I am trying to achieve:
g()
on line 4, column 3. (lines and colums are 0-based)g()
is on line 9, column 12, coming from functionh()
.call_hierarchy_item.range
coversh
, but with rust-analyzer, the range is the whole function. That means that usingcall_hierarchy_item.range.start
for the nexttextDocument/prepareCallHierachy
request returns an empty response.Here's a link to asciinema showing how this works in the editor, with gopls server:
https://asciinema.org/a/NJRympD1YW7NvrHl9rT8uWCc7
Currently, this is what happens when I try to do the same with rust-analyzer:
https://asciinema.org/a/5vElc3tQ8q7UW2nW5QkP7stAJ
I have also attached rust-analyzer and ycmd log files.
Ideally, rust-analyzer would return a range that could be used for a susequent prepare hierarchy request.
If that is considereda breaking change, maybe a new config option would be doable?
Failing that, a custom extension to the call hierarchies? I wouldn't be thrilled about a server-specific behaviour, but crrently my only option is to prevent users from trying to "switch hierarchy direction" if they are in a rust file.
rust-analyzer version:
rust-analyzer 1.81.0-nightly (a70b2ae 2024-06-09)
rustc version:
rustc 1.81.0-nightly (a70b2ae57 2024-06-09)
editor or extension: Vim/YouCompleteMe
relevant settings: no settings were changed from the defaults
repository link (if public, optional): ycm-core/ycmd#1733
The text was updated successfully, but these errors were encountered: