Hello, I’m new to using Sublime Text with the LSP (Language Server Protocol) plugin, and I’ve been working on a Rust project with the rust-analyzer
language server. I’ve successfully installed the necessary plugins, including LSP and LSP-rust-analyzer, and I can see some autocompletion working (like method suggestions), but I am struggling to get import autocompletion working.
Specifically, I am unable to see suggestions for imports (e.g., auto-imports for structs, functions, or types from external crates or the Rust standard library) in my Rust project.
Here’s what I’ve already done:
- Installed LSP and LSP-rust-analyzer via Package Control.
- Ensured that
rust-analyzer
is installed and the latest version is available viacargo
and is on my system’s path. - Configured LSP for Rust to use
rust-analyzer
(through theLSP.sublime-settings
). - Checked the LSP logs and found no errors regarding
rust-analyzer
.
What I’m hoping for:
- I want to enable import autocompletion for my Rust project. When I start typing a type or function name that isn’t imported yet, I’d like Sublime to automatically suggest the appropriate import.
Question:
- Is this feature (import autocompletion) supported by the LSP-rust-analyzer package in Sublime Text?
- If yes, what do I need to configure in the
LSP-rust-analyzer.sublime-settings
file to make it work properly? - Are there any additional settings I should enable in
rust-analyzer
itself to allow for import completions?
It would be extremely helpful to have this feature working, especially when dealing with large Rust codebases where manual imports are tedious. Any advice on getting this set up would be greatly appreciated!