Closed S4ndf1re closed 1 year ago
Properly an issue of workspace root resolving, set "workspace.bottomUpFiletypes": ["rust"]
and try again.
I tried setting the option in the CocConfig file (i hope that this is correct). I tried setting it as both the version you proposed and "rust-analyzer.workspace.bottomUpFiletypes" : ["rust"]. Both version didn't change the situation.
I tested some more: The fact that the git repo is in the parent folder isn't the problem. Im not sure what ":CocList folders" actually shows, but it always shows a parent directory of the acutal work directory. It is not always the direct parent, but folder up the file hierarchy.
Looks like coc resolving the wrong rust project root. Can you make a sample project similar with your project struct to let me debug this?
I created a simple public test repo. test repo
Every other editor (helix, vs code) i tried didn't hat such issue. Weirdly enough, this problem occures in every rust project. But i havn't really messed with the coc config. In fact, the coc config is empty. I will try to investigate further on my side, maybe with a clean nvim instance.
Im closing the issue because its a general coc nvim problem. Seems like my configuration is messed up. Thank you for trying though.
What's the output of
:CocInfo
versions
vim version: NVIM v0.8.1 node version: v18.12.1 coc.nvim version: 0.0.82-b11a93ba 2022-12-25 15:19:13 +0800 coc.nvim directory: /home/jan/.local/share/nvim/site/pack/packer/start/coc.nvim term: xterm-256color platform: linux
Log of coc.nvim
2023-02-02T19:08:29.231 INFO (pid:11489) [plugin] - coc.nvim initialized with node: v18.12.1 after 308 2023-02-02T19:08:31.287 INFO (pid:11489) [services] - LanguageClient Rust Analyzer Language Server state change: stopped => starting 2023-02-02T19:08:31.292 INFO (pid:11489) [language-client-index] - Language server "rust-analyzer" started with 11504 2023-02-02T19:08:31.303 INFO (pid:11489) [services] - LanguageClient Rust Analyzer Language Server state change: starting => running 2023-02-02T19:08:31.336 INFO (pid:11489) [services] - service rust-analyzer started 2023-02-02T19:08:35.277 INFO (pid:11489) [attach] - receive notification: highlight []
What's the output of
:CocCommand rust-analyzer.serverVersion
rust-analyzer 0.3.1386-standaloneWhat's your coc-rust-analyzer version? You can get it from
:CocList extensions
coc-rust-analyzer 0.72.0I have the following rust project:
The src/routes folder contains a corresponding mod.rs file.
No matter in what folder i start neovim (either the root folder of the project, containing the cargo.toml, or the src folder directly) my modules are not found:
If I run cargo check, everything compiles as expected. Vs Code can resolve the modules without problems.
I just installed coc-rust-analyzer. Did I mess up somehow?
Edit: everything else works as expected. I can resolve the rust standard without problems
Edit 2: it seems that the rust analyzer recognizes the parent folder as the project root. That is rather strange, because it isn't even a rust project. The only thing I can think of is, that it behaves that way because the parent dir is the git repo folder.