-
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
Feature request: Run check or clippy without saving #6591
Comments
please add this feature ❤️ |
This would really speed up development. |
You can configure some editors (including Code) to auto-save the edited files. Not sharing on-the-fly diagnostics with the compiler is a known limitation. |
Enabling auto save does not appear to trigger checking |
this is the feature that's keeping me on intellij rust |
This would be a great feature ! |
It is impossible to present the rust-analyzer vfs to rustc without a custom rustc driver. Custom rustc drivers require nightly, while rust-analyzer supports stable. |
I wonder how hard it would be to shim clippy lints into rust-analyzer diagnostics directly. clippy only runs on nightly, but maybe with some combination of codegen and some shim for the |
Rustc and rust-analyzer use fundamentally incompatible ways of working. Rust-analyzer is as lazy as possible while rustc is pretty eager. This is the reason rust-analyzer is so much faster than rls. Trying to shoehorn clippy into rust-analyzer would require giving up on the speed of rust-analyzer. |
Another reason that we need this is:
which sometimes really drives me crazy that after saving I'll need to wait 10 seconds to be able to see diagnostics |
IntelliJ certainly does not implement its own rustc driver, right? How do they implement this feature? autosave + check-on-save? |
I assume they simply already reproduce more of the diagnostics rustc produces in their kotlin code. Other than that they simply run cargo check pretty much the same way as rust-analyzer it seems: https://github.com/intellij-rust/intellij-rust/blob/58079c90c737b5357aadc629fda79c5cc8790760/src/main/kotlin/org/rust/cargo/toolchain/tools/Cargo.kt#L328 They do save all files before running it though: https://github.com/intellij-rust/intellij-rust/blob/118d9d9005c8fa611df6837212c92707d4a09a18/src/main/kotlin/org/rust/ide/annotator/RsExternalLinterUtils.kt#L107 |
I've confirmed that configuring VS Code as follows makes this work: {
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1000,
"rust-analyzer.checkOnSave.enable": true
} Since this issue is not about RLS-like compilation using unsaved files, but about IntelliJ's feature, which works the same way, I'm closing this as fixed (or rather, responsibility of the client, and not something rust-analyzer can do server-side). |
One problem here, autosave cannot be set per language in vscode. |
@GopherJ you contradict yourself in this comment. You're saying I have to use
@MaximilianHollis it will slow down development, because your computer will become unresponsive due to constant 100% CPU usage. I think we should work more on optimizing |
Don't start arguments in the issue tracker please |
But you can do it per workspace, I think that this is a good workaround |
Coming from #4185 Is this still not possible to do without below hack?
Which I don't want to run as I run rust code with Anything one can do to help implement this needed feature? |
This needs a rustc change to support loading files from rust-analyzer's VFS instead of the disk. |
Is there an open issue in rustc about it or should we open it? |
I think you can disable check on save, put |
I want to be using Error Lens extension to see errors inline. |
If you use the |
This would be similar to the feature in IntelliJ Rust called "Run external linter to analyze code on the fly"
The text was updated successfully, but these errors were encountered: