with rust-analyzer, import prompts are surfaced with the "quick fix" menu: image.png
In other languages, this is surfaced in the auto complete image.png and as a "preferred quick fix" on the side indicated with the blue light bulb.
I would really prefer it if you were able to auto import things with the auto complete menu instead of with the quick fix, because it's different than all the other languages I use and it uses a different keyboard shortcut in VS Code
This might not even be terribly difficult to implement nowadays :)
Yeah! If you look at https://microsoft.github.io/language-server-protocol/specifications/specification-3-16/#textDocument_completion
additionalTextEditscan be specified and indeed the comment is:
- Additional text edits should be used to change text unrelated to the current cursor position
* (for example adding an import statement at the top of the file if the completion item will
* insert an unqualified type).
resolve support was added to delay that computation as a performance enhancement