You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two major suggestions to improve the autocompletion results from Rust-analyzer.
Using rust-analyzer (from Zed), constants, functions, and statics are prioritized over macros when doing an exact match, often with quite surprising results.
For example, try to autocomplete panic:
rust-analyzer gives as the first result the core function panic, which end users should almost never use, instead of the obvious panic! macro. (Oddly, it also gives the panic! macro twice, a small bug.)
Likewise for format, the macro, which I would assume in 99% of cases what users want, is the 6th option.
Assert is similar to panic:
Personally, I'd love to see assert_eq ranked over assert. Note that a function assert_equal (which I haven't imported, but exists in namespace from itertools as a dependency) is prioritized over assert_eq.
It seems like macros are heavily de-prioritized. Here's autocompletion giving results for pr:
Which is a bunch of constants associated with a sql parsing crate that is a dependency but hasn't been imported anywhere in the file. Contrast the autocomplete results with those from IntelliJ for the same letters & position:
IntelliJ results are:
a "live template" with an exact string match for pr (what RA calls a snippet)
the macro println!, which in my experience, is used much more frequently than print
a local function parse_recipient
the print! macro
various other results that haven't been imported yet.
The intellij results are dramatically more helpful than the RA ones.
intellij seems to either have an embedded manual ranking, or it actually prioritzes longer matching strings over shorter. (E.g. pr ranks println before it ranks print). It's somewhat counterintuitive, but I see a compelling argument for matching longer strings before shorter ones: there are more characters to type, and therefore you prefer to rely on autocomplete more, when it's a longer string.
The text was updated successfully, but these errors were encountered:
That's odd. What editor are you using in your screenshot? Zed is my go to, and import paths are not visible in the previous screenshots that I posted. Maybe it's only a Zed frontend issue then.
I have two major suggestions to improve the autocompletion results from Rust-analyzer.
Using rust-analyzer (from Zed), constants, functions, and statics are prioritized over macros when doing an exact match, often with quite surprising results.
For example, try to autocomplete panic:
rust-analyzer gives as the first result the core function panic, which end users should almost never use, instead of the obvious
panic!
macro. (Oddly, it also gives thepanic!
macro twice, a small bug.)Likewise for
format
, the macro, which I would assume in 99% of cases what users want, is the 6th option.Assert is similar to panic:
Personally, I'd love to see
assert_eq
ranked overassert
. Note that a functionassert_equal
(which I haven't imported, but exists in namespace fromitertools
as a dependency) is prioritized overassert_eq
.It seems like macros are heavily de-prioritized. Here's autocompletion giving results for
pr
:Which is a bunch of constants associated with a sql parsing crate that is a dependency but hasn't been imported anywhere in the file. Contrast the autocomplete results with those from IntelliJ for the same letters & position:
IntelliJ results are:
println!
, which in my experience, is used much more frequently thanprint
parse_recipient
print!
macroThe intellij results are dramatically more helpful than the RA ones.
intellij seems to either have an embedded manual ranking, or it actually prioritzes longer matching strings over shorter. (E.g.
pr
ranksprintln
before it ranksprint
). It's somewhat counterintuitive, but I see a compelling argument for matching longer strings before shorter ones: there are more characters to type, and therefore you prefer to rely on autocomplete more, when it's a longer string.The text was updated successfully, but these errors were encountered: