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

Rust analyzer does not activate for new tabs and windows opened in neovim #1099

Open
Pxartist opened this issue Jan 12, 2023 · 5 comments
Open
Assignees

Comments

@Pxartist
Copy link

Pxartist commented Jan 12, 2023

What's the output of :CocInfo

versions

vim version: NVIM v0.8.2
node version: v14.18.3
coc.nvim version: 0.0.82-b11a93ba 2022-12-25 15:19:13 +0800
coc.nvim directory: C:\Users\frede\AppData\Local\nvim-data\plugged\coc.nvim
term: undefined
platform: win32

Log of coc.nvim

2023-01-11T17:17:56.965 INFO (pid:18156) [plugin] - coc.nvim initialized with node: v14.18.3 after 121
2023-01-11T17:18:05.412 INFO (pid:18156) [attach] - receive notification: showInfo []

What's the output of :CocCommand rust-analyzer.serverVersion

[coc.nvim] rust-analyzer 0.3.1348-standalone (643bc02de 2023-01-01)

What's your coc-rust-analyzer version? You can get it from :CocList extensions
coc-rust-analyzer 0.71.1 ~\AppData\Local\coc\extensions\node_modules\coc-rust-analyzer

ISSUE

When opening new, additional rust files in windows and tabs in neovim after the very first Rust file, the Rust analyzer does not activate for the subsequent files. The only workaround I have found so far is to execute :CocCommand rust-analyzer.reload to get the later files to have Rust code analysis.

For example: If I open an .rs file in neovim, it will have Rust analysis. If I open one or more .rs files in new windows or tabs within the same neovim instance, they will not have Rust code analysis unless I run :CocCommand rust-analyzer.reload

I do not see any possible configuration settings in the README.md that can address this issue and would like to know if there are any other methods besides having to run :CocCommand rust-analyzer.reload for each new tab or window that I open.

A new configuration setting that addresses this would be greatly appreciated.

@fannheyward
Copy link
Owner

My tests:

Cargo.lock
Cargo.toml
src/
src/main.rs
  1. nvim src/main.ts, rust-analyzer launches and works as expected
  2. tabnew to a new tab
  3. some rust code, for example error code println!("{}", xyz);, :w src/lib.rs to new file
  4. rust-analyzer reports diagnostic on xyz cannot find in lib.rs, without reloading

I've watchman installed, you can try https://github.com/neoclide/coc.nvim/wiki/Install-coc.nvim#install-watchman-for-file-watching

@Pxartist
Copy link
Author

I have followed the installation instructions for watchman and have added it to my PATH. It does not appear to work and the documentation for Windows based systems is rather lacking.

Is this issue upstream in regards to the rust-analyzer or is it with the implementation of it in this plugin? It appears that I am the first one with the desire for rust-analyzer to work with multiple tabs and windows as I have not found any similar issues online elsewhere.

@Pxartist
Copy link
Author

I would also like to add that :CocRestart also appears to have the same results as well, although I currently only have coc-rust-analyzer installed.

@fannheyward
Copy link
Owner

Still can't reproduce this on macOS, have no idea about this. It's properly issue of rust-analyzer. Can you reproduce this with VSCode + rust-analyzer?

@Pxartist
Copy link
Author

Pxartist commented Feb 1, 2023

Still can't reproduce this on macOS, have no idea about this. It's properly issue of rust-analyzer. Can you reproduce this with VSCode + rust-analyzer?

I have been able to replicate the issue using a default VSCode installation and rust-analyzer installation acquired from here: https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer. Any rust files opened after the very first one will no longer have error detection or code suggestion / completion.

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

No branches or pull requests

2 participants