Stream: t-compiler/wg-rls-2.0

Topic: Go to anywhere action


Kirill Bulatov (Jan 21 2020 at 13:03, on Zulip):

Every now and then (especially when I see a complex inlay hint), I want to open a file with a declaration of the specifically named enum/trait/struct/method, either in the project code or in some dependency's.

Intellij Rust achieves this by providing "Go to anywhere" action: it's basically a text input with a panel that displays the search results based on the input.

It feels like RA is with its symbol_index::world_symbols from ra_ide has everything we need to suppord this kind of functionality.

Am I right or is there something I've missed?
Does it make sense to implement this feature?
Does LSP support this on the API level or should we come up with some custom action again?

Emil Lauridsen (Jan 21 2020 at 13:08, on Zulip):

VSCode has "Go to Symbol in Workspace..." which works decently right now, although it's a little tricky with regards to how it returns types or functions. Not sure how it works LSP wise

Kirill Bulatov (Jan 21 2020 at 13:11, on Zulip):

Yeah, no methods resolved and no results shown for the dependencies.
I wonder if that can be improved somehow.

std::Veetaha (Jan 21 2020 at 13:11, on Zulip):

Thank you for Go to Symbol in Workspace reference, I always used just a simple project-wide text search for that task xD

Emil Lauridsen (Jan 21 2020 at 13:13, on Zulip):

Yeah, no methods resolved and no results shown for the dependencies.
I wonder if that can be improved somehow.

It will resolve functions but only when your search becomes "specific enough", and at that point it seems like it only returns functions.

Kirill Bulatov (Jan 21 2020 at 13:16, on Zulip):

Indeed.
Well, that's something I can live with already, thank you :)

Florian Diebold (Jan 21 2020 at 13:18, on Zulip):

I think there are special characters you can append to search in functions and/or dependencies, one of them was #, I don't remember the other one

Emil Lauridsen (Jan 21 2020 at 13:20, on Zulip):

I think there are special characters you can append to search in functions and/or dependencies, one of them was #, I don't remember the other one

The symbols modify behavior of the file picker:# is workspace wide, @ is current file, not sure if there's equivalents to search for specific kinds of things in those scopes.

Kirill Bulatov (Jan 21 2020 at 13:20, on Zulip):

Looks like those are the options available:

pasted image

Florian Diebold (Jan 21 2020 at 13:28, on Zulip):

no, I was thinking of this: https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/features.md#workspace-symbol-ctrlt

matklad (Jan 21 2020 at 13:37, on Zulip):

@Kirill Bulatov you can append # and * symbols to the symbols query to get symbols from dependeices / symbols including the function

Kirill Bulatov (Jan 21 2020 at 13:41, on Zulip):

Lovely, now I get all I need.
Thank you all.

matklad (Jan 21 2020 at 15:45, on Zulip):

Recorded a demo: https://twitter.com/rust_analyzer/status/1219647139149754368

Kirill Bulatov (Jan 29 2020 at 15:18, on Zulip):

Getting back there.
Is this feature something that we implement?

I find it a bit confusing that there's no std::sync::Arc in the results:
pasted image

Also there are no results for the std::io::Read for some reason:
pasted image

matklad (Jan 29 2020 at 15:20, on Zulip):

"the same reason" we show only the original struct and not the reexport?

Kirill Bulatov (Jan 29 2020 at 15:20, on Zulip):

Right, reexports.

But what's up with Read?

matklad (Jan 29 2020 at 15:42, on Zulip):

Hm, my guess would be that it collides with lowercase read method

matklad (Jan 29 2020 at 15:43, on Zulip):

I think we've fixed that a long time ago, but maybe not fully

matklad (Jan 29 2020 at 15:43, on Zulip):

(we store lowercased names in the index)

matklad (Jan 29 2020 at 15:44, on Zulip):

The relevant file to look into is symbol_index (I highly recommend checking it and the underlying fst crate out, it's good stuff)

Kirill Bulatov (Jan 29 2020 at 15:57, on Zulip):

Thanks for the pointers.

Last update: Jun 07 2020 at 10:45UTC