-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Feature request: Go to definition should be read-only when going outside workspace #17569
Comments
We can't really do much here, the language server protocol has nothing that allows us to tell the client that the file is readonly. And on the VSCode side readonly files are configured by a setting, I don't like rust-analyzer modifying the settings of a user too much, especially if we do it automatically. We could offer a command maybe / put a button the landing page that adds the appropriate entry to the setting. For context, the following config will make the standard libraries of all toolchains as well as all your crates-io libraries readonly "files.readonlyInclude": {
"**/.cargo/registry/src/**/*.rs": true,
"**/lib/rustlib/src/rust/library/**/*.rs": true,
}, |
I did not know those two settings existed. I agree that they prevent most accidental edits. I think it would be a really nice service if rust-analyzer somehow made the users aware of this setting/helped them enable it, though I don't have an opinion on how to do this. |
internal: Remove faq landing page, improve main one Having more than one is potentialyl annoying as both will get opened upon install, using walkthroughs for this is not ideal. So this merges the two and also adds a couple tips, fixes rust-lang/rust-analyzer#17569
I guess we could also show a notification here: "you're editing a file under |
I often edit files in
~/.cargo/registry
by accident, because I thought I was in a local copy of a crate.Vscode has support for marking files as read-only (and other editors probably do as well). It would be nice mark files outside the current workspace as read-only by default, or otherwise introduce a small speedbump to prevent accidental editing of these files.
As a bonus extra feature, perhaps it should be possible to white-list certain paths outside the workspace, so they would also open in read-write mode.
The text was updated successfully, but these errors were encountered: