Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Enable Import Autocompletion with rust-analyzer in Sublime Text LSP? #150

Open
brupelo opened this issue Dec 15, 2024 · 0 comments
Open

Comments

@brupelo
Copy link

brupelo commented Dec 15, 2024

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:

  1. Installed LSP and LSP-rust-analyzer via Package Control.
  2. Ensured that rust-analyzer is installed and the latest version is available via cargo and is on my system’s path.
  3. Configured LSP for Rust to use rust-analyzer (through the LSP.sublime-settings).
  4. 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant