You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Users are not supposed to edit Rust source files inside CARGO_HOME (~/.cargo/registry), since these are meant to be immutable snapshots of crates. These files are treated as disposable, so users editing them by accident can lose their work.
Rust-analyzer's "jump to definition" function will happily jump to these files. This makes it easy to accidentally open a file of a dependency. Jumping to view these files is not bad per-se, but editing them by accident is problematic.
Actual behavior
Could you open Cargo registry files in read-only mode? Or show some kind of warning that the file is not supposed to be edited?
I'm not too familiar with the LSP plugin, but I think that would be responsible for setting the view read-only.
This plugin does this already (see here). When using the build system, if there is a diagnostic that points to something outside of the workspace, the view is opened read-only.
I'm going to close as I don't think there is anything this extension can do. The LSP extension is a separate project. I suspect it wouldn't be possible for it to know whether or not the file should be read-only (unless that is part of the LSP protocol).
We are looking to make the src cache read-only over at rust-lang/cargo#9455, though we ran into some problems which will need some more work.
I realize this is an annoying issue, and trips up people quite a bit. Hopefully progress can be made on the cargo side.
Sublime Text Version
4133
Rust Enhanced Version
2.24.0
Operating system
macOS Big Sur
Expected behavior
Users are not supposed to edit Rust source files inside
CARGO_HOME
(~/.cargo/registry
), since these are meant to be immutable snapshots of crates. These files are treated as disposable, so users editing them by accident can lose their work.Rust-analyzer's "jump to definition" function will happily jump to these files. This makes it easy to accidentally open a file of a dependency. Jumping to view these files is not bad per-se, but editing them by accident is problematic.
Actual behavior
Could you open Cargo registry files in read-only mode? Or show some kind of warning that the file is not supposed to be edited?
Steps to reproduce
References
The text was updated successfully, but these errors were encountered: