-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
How to configure to attach a rust lsp client for single file #5142
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
Comments
It's not supported rust-lang/rust-analyzer#6388 |
It is though rust-lang/rust-analyzer#8955 |
@anstadnik how do you actually use the feature you linked? The PR doesn't explain it, and it doesn't seem to work out-of-the-box (running |
I used https://github.com/simrat39/rust-tools.nvim, which supports the standalone feature. I'm not the developer, so I can't tell you how it uses the feature. |
Ah, I'd assumed you had it working in Helix |
You can use rust-analyzer with non-cargo projects like single files but you need to tell rust-analyzer about the project with a |
you could use local lsp_conf = require('lspconfig')
lsp_conf.rust_analyzer.setup {
-- Other setup stuff
-- ...
-- To be able to start rust-analyzer at all a root_dir is needed,
-- I added a star match for testing purposes to match on any file
-- This could be an lspconfig/Neovim only issue
root_dir = lsp_conf.util.root_pattern("*"),
-- LSP Client needs to know the detached files ahead of time on
-- initialization and pass them to the r-a on startup
init_options = { detachedFiles = { "/tmp/file.rs" } }
} from: rust-lang/rust-analyzer#14318 (comment) |
No description provided.
The text was updated successfully, but these errors were encountered: