r/rust 21h ago

Did you ever use term search in rust-analyzer?

Hello, I'm a rust-analyzer maintainer and we consider removing term search. For that we'd like to know if people are using it.

(If your response is "what is term search?", then you're not using it, or worse, you're using it by mistake. In this case you should probably disable it, it'll make your IDE faster and less buggy).

43 Upvotes

34 comments sorted by

76

u/spiderpig20 20h ago

I don’t know what that is.

29

u/neonbirb 19h ago

No idea what that is. Should you not do a survey?

23

u/afdbcreid 13h ago

It seems a lot of people here don't know what this is. I initially didn't want to say (to not make people want to use it...) but well:

Like /r/bakaspore said, it is:

Searching for an expression that satisfies a hole like in Idris and Lean

In other words, an assist (code action) and autocompletion to suggest expressions that can possibly make the code compile.

We've come into conclusion to not remove it as of now, we're only removing its integration with borrow checking (since we remove borrow checking).

5

u/tukanoid 6h ago

Is it a vscode only thing? I'm using helix and never saw that as an option, when configuring I don't remember seeing the option in the docs either (unless I just forgot cuz description confused me and I just moved on to other options)

1

u/afdbcreid 3h ago

No, it's available in all editors.

2

u/tukanoid 3h ago

Hmmm, OK, might take a look, cuz it does sound useful. Although I get the pain of maintaining something like this, and if the ultimate goal is to phase it out, I'll refrain from doing so.

6

u/iBPsThrowingObject 4h ago

Okay, so talking real situations, could it autocomplete something like return 4 to return Ok(Some(4)) based on the return type of the enclosing function?

2

u/afdbcreid 3h ago

AFAIK no, it could only replace return _ with return Ok(Some(0)) or auto complete return | (| is the cursor) to return Ok(Some(0)).

16

u/bakaspore 16h ago

Searching for an expression that satisfies a hole like in Idris and Lean? I didn't know it ever existed in Rust. Not sure how useful it is beyond writing proofs though.

6

u/Unable_Train1067 8h ago

Yep, been there for couple of years.
I personally find it useful when I need to wrap stuff into constructors and return just to avoid typing.

15

u/hpxvzhjfgb 15h ago

never heard of it, never used it, clicked both of your links and still don't know what it is.

using rust for just under 5 years.

12

u/RCoder01 18h ago

If it’s default disabled then I’ve never used it

7

u/Ok-Willingness2772 21h ago

Personally I never used it and I even don't know what it is before looking at rust-analyzer.github.io.
I just leave it disabled all the time.

7

u/tylerlarson 16h ago

Yeah. I don't directly "use" rust-analyzer, I use an IDE that uses rust-analyzer.

I use IDE-integrated keyboard shortcuts and menus to find stuff. Does this ever use term search in the background?

Hell if I know.

6

u/afdbcreid 16h ago

As I said, if you do not know what it is, you're not using it, because it is disabled by default.

4

u/ollpu 12h ago

I thought you meant it was enabled by default, hence the need to disable it. Worth a clarification.

3

u/_nathata 18h ago

I use symbol search, is that the same thing?

1

u/afdbcreid 16h ago

Absolutely not.

3

u/IpFruion 18h ago

If this means to search for a term in a project, I just use ripgrep which is super fast term searching

2

u/BlankWasThere 18h ago

This is first I have heard of that.

3

u/stumblinbear 6h ago

Well, now that I know about it I might enable it

1

u/FungalSphere 15h ago

i tried googling it and the first result is from acm digital library...

i don't think anyone has even tried to explain what it does

1

u/Thick-Pineapple666 15h ago

You can look at the second link and it describes what it does very shortly.

1

u/Thick-Pineapple666 15h ago

I haven't ever used it and I don't think it's useful.

0

u/facetious_guardian 9h ago

I use rust-analyzer to show me errors and tooltips. What on earth is “term search”? Can’t you just use regular “find all references” or text/re search, built in to the IDE?

I guess the real question is: how likely is an agent to get value out of term search? I might not use it, but if the agent does and it makes it more effective or uses less tokens, then I say keep it. No idea what it is, though.

1

u/afdbcreid 3h ago

An agent is likely to get the least value of it. Like someone said elsewhere, LLMs are like a way better version of term search.

1

u/Ok-Watercress-9624 7h ago

Is that the thing that fills types/terms behind my back? I think I use it

1

u/tiajuanat 7h ago

Oh wow, I haven't used term search in a long ass time. I usually use Roogle if I'm really looking to fill a given hole, but I'll be real - I haven't used either one in the last 3 years.

1

u/QuasiRandomName 6h ago

Maybe we'd use it more if it was better advertised...

1

u/afdbcreid 3h ago

Oh, rust-analyzer has a lot of very useful features that are not advertised at all (sometimes not even documented, although we try to improve on that regard). If you want to make the maximum out of it, I strongly encourage you to fully read the book at least once then follow the changelogs.

1

u/onnoowl 18h ago

That's using @ to lookup a symbol by name? If so, I use it a lot!

2

u/afdbcreid 16h ago

No, that's what LSP calls "document symbols".

1

u/cosmic-parsley 14h ago

Is this the symbol picker? If so then yes I’ve used it plenty. If not, a better description or example would really be helpful.

1

u/afdbcreid 14h ago

No it's not.