rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Using `rust-analyzer` with worktrees causes file watcher to watch every worktree

Open tcharding opened this issue 1 year ago • 2 comments

When I use rust-analyzer within a repo that uses git worktrees, one directory for each branch, r-a watches all the directories within the repo. Then runs many cargo instances (this is a Rust repo). This chokes my whole system.

Is it possible to configure the file watcher to more finely?

FTR I have ~ 90 worktrees in the repo at the moment.

Thanks

tcharding avatar Feb 11 '24 22:02 tcharding

could this help?

https://github.com/rust-lang/rust-analyzer/blob/543d7e98dbcc0668528dbf3f5b32d752882baa33/editors/code/package.json#L952-L959

Young-Flash avatar Feb 21 '24 03:02 Young-Flash

Thanks for the response, I considered excluding directories but then I would have to manually un-exclude the ones I'm "working" on for some definition of working on. What I really want is all the git worktree directories to be excluded unless there is a file within them open i.e., opening any file in a git worktree directory causes RA to start processing all files in that particular git wortkree.

tcharding avatar Feb 21 '24 04:02 tcharding