Open baxterjo opened 3 days ago
Hmm... I'm not sure it would be better. This is an exact match after all.
I'd probably prefer a prefix match to rank above an exact match flyimport, because if it's wrong, it's only wrong once (assuming you actually import it).
Hmm... I'm not sure it would be better. This is an exact match after all.
Exact match makes sense if from a pure text search perspective. But I would argue that DX and context matter here.
The primary goal should be to do the least work possible first, then to provide a good match. Matches that take no action other than autocomplete should be ranked above matches that both autocomplete and import, regardless of the exactness of the match. Because if the match with imports happens to be wrong, the developer must go to the top of the file and undo what rust-analyzer did before continuing their work. This is very disruptive to workflow.
I'd probably prefer a prefix match to rank above an exact match flyimport, because if it's wrong, it's only wrong once (assuming you actually import it).
I don't fully understand what you mean in the second half of this comment, but I think we're on the same page?
I assume that developers rarely accept the wrong completion. Also if they do, it's a matter of Undo, no need to go to the top of the file. But the argument @lnicola provided is convincing.
I see a lot of issues about the scope of one import vs another. But I'm experiencing a lot of frustration when using the auto complete feature for in scope variables competing with auto import.
Example
This seems completely unexpected. I would assume local vars should always be prefered over importing a new module in terms of auto complete.