-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Document reference search for constructiors/initializations #10725
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
Comments
We actually already have this, though rather obsure(and possibly not really documented). struct S$0 {
pub x: usize,
}
fn print_s(s: S) {
println!("{}", s.x)
}
fn main() {
let s = S { x: 42 };
print_s(s);
} (that is the cursor at the far end of the definition's ident) Nevertheless we should document this behaviour better, assuming we don't yet. |
Doesn't rust-analyzer have many extensions to the LSP already? I could imagine r-a decides to supports thi, and then upstreams a proposal to the folks maintaining LSP (I guess Microsoft). Is this not a good model for how the process works? In the meantime, thanks for the workaround. |
The main problem here is the question how to even expose this, we could make an extension out of this but that would require each client to somehow expose this special search as well. And in VSCode for example I don't think there is a decent way to offer more "kinds" of reference searches than the default. |
The workaround doesn't work for me on version
|
Did you mean to leave this comment on my other issue, #10713 ? |
Ah I typed rename by accident, meant reference search of course. |
Wrong again, its on the struct S $0{
...
} should show you all constructor usages, same applies for |
Thanks, that works. |
"find references" on
S
in the above program will find both the usage ofS
in the type of the parameter toprint_s
, as well as the use ofS
in the instantiation ofs
inmain
. However, I often want to see all the places where a struct is created, without having to hunt through the list of all references for those specific ones.The text was updated successfully, but these errors were encountered: