-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
workspace symlink causes error #3691
Comments
I hit this issue as well. It looks like rust-analyzer chokes if a crate file is opened via a symlinked path anywhere in its parent directories (i.e. the symlink can be to a parent, not just the crate folder itself). |
Similarly, I most of the time (though not always) get |
I think the offending function is here: https://github.com/rust-analyzer/rust-analyzer/blob/3a38554f86e5e1b41b111ed8ccc688e84a9d5ae4/crates/vfs-notify/src/lib.rs#L148-L202
|
I doubt that, proper handling of symlinks I think needs to be pretty invovled. Though, it definitelly is worth to try this! If this gets us 80% soln, then great! |
I don't think it needs to be particularly involved. AFAICT, for all rust-analyzer's purposes, the Right Thing is to treat symlinks transparently:
I audited a lot of code, including all of the |
We use |
It doesn't, much. Inotify is inode-based, not path-based. You don't have to worry about getting confused by a notification about a path outside your tree because those notifications will never mention any path at all, they'll only mention the watch descriptor. Just avoid providing the |
The one-liner fix seems at least to resolve this bug for my personal use case which is mozilla/nixpkgs-mozilla#238. I'll open a PR marked as WIP pending further testing to make sure inotify events get handled properly. |
6246: Follow symlinks when walking project trees r=lnicola a=dfoxfranke Fixes #3691. ~~WIP pending further testing~~: - [X] Verify that symlinked files get indexed. - [x] Verify that files in symlinked directories get indexed. - [x] Verify that inotify events are properly received and handled when the target of a symlink resides outside the project tree. Co-authored-by: Daniel Fox Franke <dfoxfranke@gmail.com>
If the root workspace (maybe even regular single crate) is symlink, rust-analyzer reports error "Rust file outside current workspace is not supported yet".
E.g. if we have project
foo
which is symlink:User opening up
/home/me/foo/src/lib.rs
will cause error.Workaround is open real path, but rust-analyzer should just follow symlink if possible (or change error message, as it is misleading).
The text was updated successfully, but these errors were encountered: