rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.13k stars 1.58k forks source link

Changes to rust-project.json requires restarting language server #11241

Open AlexanderEkdahl opened 2 years ago

AlexanderEkdahl commented 2 years ago

Hi,

We use rust-project.json for a non-Cargo project and a relatively minor issue is that whenever the generated rust-project.json file changes, rust-analyzer must be restarted for editor features to resume working.

I assumed this would require a relatively minor change so I tried adding "{}/**/rust-project.json" to list of files to be watched for changes. However, after trying out this change locally I still have to restart rust-analyzer for changes to take affect.

Is it feasible to have rust-analyzer automatically detect and re-configure when rust-project.json changes? If so, any ideas as to what other changes may be required to make this work? Happy to work on it.

At the very least it would be useful to have a pop-up whenever rust-project.json changes to prompt the user to restart the language server.

woody77 commented 2 years ago

I think that if VSCode is being used as the file-watcher, then any tooling-initiated changes to rust-project.json won't be detected. (I've investigated this in the past and couldn't find a way to get RA to "see" changes to rust-project.json).

flodiebold commented 2 years ago

@woody77 The VSCode file watcher should detect outside changes to the files as well.

As for the original question, I think at least should_refresh_for_change would also need to be adapted.