fix: Support filesystems that don't send Create events#21844
fix: Support filesystems that don't send Create events#21844Wilfred wants to merge 2 commits intorust-lang:masterfrom
Conversation
|
I've tested on FUSE a bunch, but not much on non-FUSE. I can get you some more thorough benchmarks next week, I don't have much time for r-a this week I'm afraid. |
This is not a logical change, and just makes the next commit simpler. It also shouldn't impact performance, because the vast majority of events have a single path.
On some filesystems, particularly FUSE on Linux, we don't get
Create(...) events. We do get Access(Open(Any)) events, so handle
those consistently with create/modify/remove events.
This fixes missed file notifications when using Sapling SCM with
EdenFS, although I believe the problem can occur on other FUSE
environments.
Reproduction:
Commit a change with Sapling that adds a new file foo.rs and
references it with `mod foo;` in lib.rs. Configure rust-analyzer as
follows:
```
{
"rust-analyzer.files.watcher": "server",
"rust-analyzer.server.extraEnv": {
"RA_LOG": "vfs_notify=debug"
},
}
```
Go to the previous commit, restart rust-analyzer, then go to the next
commit. The logs only show:
```
2026-03-18T07:16:54.211788903-07:00 DEBUG vfs-notify event event=NotifyEvent(Ok(Event { kind: Access(Open(Any)), paths: ["/data/users/wilfred/scratch/src/foo.rs"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }))
2026-03-18T07:16:54.211906733-07:00 DEBUG vfs-notify event event=NotifyEvent(Ok(Event { kind: Access(Open(Any)), paths: ["/data/users/wilfred/scratch/src/foo.rs"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }))
2026-03-18T07:16:54.216467168-07:00 DEBUG vfs-notify event event=NotifyEvent(Ok(Event { kind: Access(Open(Any)), paths: ["/data/users/wilfred/scratch/src/lib.rs"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }))
2026-03-18T07:16:54.216811304-07:00 DEBUG vfs-notify event event=NotifyEvent(Ok(Event { kind: Access(Open(Any)), paths: ["/data/users/wilfred/scratch/src/lib.rs"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }))
```
Observe that `mod foo;` has a red squiggle and shows "unresolved
module, can't find module file: foo.rs, or foo/mod.rs". This
commit fixes that.
c6821b7 to
19e0346
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Yep, testing this with non-FUSE (i.e. a normal filesystem) and server-side watching seems fine. I've tested a rust-analyzer build with rust-analyzer open as a repository in VS Code, and performance seems entirely normal in my testing. I've also cherry-picked this PR for the users I support at work and not seen any issues there either, so I'm pretty confident these changes are good. Happy to do any other tests you can think of, if I've missed anything :) |
On some filesystems, particularly FUSE on Linux, we don't get Create(...) events. We do get Access(Open(Any)) events, so handle those consistently with create/modify/remove events.
This fixes missed file notifications when using Sapling SCM with EdenFS, although I believe the problem can occur on other FUSE environments.
See the individual commit messages for more details.