rust-lang / rust-lang/rust-analyzer

Changes to rust-project.json requires restarting language server

Open
#11,241 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-rust-project C-feature
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in crates/rust-analyzer/src/reload.rs, especially the watched-file list around lines 254-256, and trace how rust-project.json changes are handled. Determine what is needed for rust-analyzer to reconfigure automatically, or establish the restart-prompt behavior as an alternative. Done means changes to a generated rust-project.json no longer require a manual restart, or the user is clearly prompted to restart.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.