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

Reload workspace when cargo.toml is changed from outside(e.g. cargo add) #423

Closed
wakuflair opened this issue Jun 13, 2024 · 8 comments · Fixed by #427
Closed

Reload workspace when cargo.toml is changed from outside(e.g. cargo add) #423

wakuflair opened this issue Jun 13, 2024 · 8 comments · Fixed by #427
Labels
enhancement New feature or request needs triage

Comments

@wakuflair
Copy link

wakuflair commented Jun 13, 2024

Feature description

Now when I add a crate via cargo add, I need to manually open the cargo.toml and :w to force reloading the workspace.

It is better to watch the cargo.toml and reload no matter how it changed.

@wakuflair wakuflair added the enhancement New feature or request label Jun 13, 2024
@mrcjkb
Copy link
Owner

mrcjkb commented Jun 13, 2024

Hey 👋

This is out of scope for rustaceanvim and would need to be implemented in rust-analyzer.
See also: rust-lang/rust-analyzer#16683

@mrcjkb mrcjkb closed this as not planned Won't fix, can't repro, duplicate, stale Jun 13, 2024
@mrcjkb mrcjkb added upstream and removed enhancement New feature or request labels Jun 13, 2024
@wakuflair
Copy link
Author

wakuflair commented Jun 13, 2024

I'm curious why VSCode can have it reloaded automatically.

@mrcjkb
Copy link
Owner

mrcjkb commented Jun 13, 2024

It does?
Then I suppose it's a VSCode feature. I'll reopen (maybe it's possible to implement using libuv filesystem events).
But I'll have to give it some thought.

@mrcjkb mrcjkb reopened this Jun 13, 2024
@mrcjkb mrcjkb added enhancement New feature or request needs triage and removed upstream labels Jun 13, 2024
@wakuflair
Copy link
Author

It does?

Yes, I can show you:

vscode.mp4

@Veykril
Copy link

Veykril commented Jun 13, 2024

If the file watcher is registered as the client (which should be the default) it is the client's job to inform the server of any relevant file changes.

@mrcjkb
Copy link
Owner

mrcjkb commented Jun 13, 2024

If the file watcher is registered as the client (which should be the default) it is the client's job to inform the server of any relevant file changes.

This should probably be implemented via the didChangeWatchedFiles spec, which is implemented in Neovim core, but has been disabled on Linux for performance/reliability reasons.

As I said, this is likely out of scope for rustaceanvim, so I will have to put some thought into it.

@Veykril
Copy link

Veykril commented Jun 13, 2024

In that case you could probably hardcode the rust-analyzer.files.watcher config to be set to "server" when telling rust-analyzer about the configurations, that will make it use its own watcher. (though again the LSP does recommend the client watcher to be used)

@mrcjkb
Copy link
Owner

mrcjkb commented Jun 13, 2024

Perhaps it makes sense to check if the neovim has the client capability and hardcode the config if it doesn't. That way we don't risk running into problems if neovim enables the capability again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants