-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Provide a way to abort/suspend "cargo check" #4828
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
Comments
This is definitely possible once we move to fully lsp-compatible progress reports for |
For now, a workaround is to save a file again without changing anything. This should cancel the check and yield the lock to the operation you've got waiting in your terminal. |
That doesn't help with I sometimes even get strange errors about not finding particular crates in the sysroot or so when my |
For working on libstd I actually switched back to using another editor as vscode keeps rechecking all of rustc after each save, which is rather excessive. |
You can always disable the flycheck/check-on-save functionality and manually invoke |
Ah good point, I didn't realize there is a way to disable it. I never used "vscode runnables", will have to look into this. Thanks! |
{
"rust-analyzer.checkOnSave.enable": false,
} |
@RalfJung Ah sorry, that's because they're called "Tasks" and not runnables. |
Something like:
In tasks.json should be a starting point, I'm not able to check it right now though. |
I have configured my tasks.json as follows:
However, this behaves very differently from the normal "check" task. it opens a terminal to show the output with all the glorious JSON, and more important it does not actually interpret the JSON to highlight the errors in the code -- making it basically useless. Is there a way to tell it to parse the JSON the way it normally would? |
I recently got rust-analyzer working in Sublime Text editor and now encountered the same issue.
I'm not really familiar with the technical details of LSP, but if its possible I'd suggest a different approach where That way a key mapping could be bound to that command on the client and specifically executed by the user whenever desired/required. |
I'm not sure how good LSP is supported in Sublime Text 3, but there's a custom command in rust-analyzer, that allows running a "clever" cargo check: it's supported in VSCode part of rust-analyzer and there might be a way to support it in Sublime? |
Their docs list an LSP implementation status, but I'm not seeing anything However there is also more info regarding executing server commands. Other than that these are the possible server-specific settings that can be configured in the plugin (any of rust-analyzer's settings can be set in // Sent to server once using workspace/didChangeConfiguration notification
"settings": { },
// Sent once to server in initialize request
"initializationOptions": { },
// Disable providers if so desired
"disabled_capabilities": { },
// Extra variables to override/add to language server's environment.
"env": { }, PS: I'm actually using ST4, as far as I know the last LSP plugin version for ST3 is relatively old and not being updated anymore (unfortunately ST4 currently also requires a license). |
Sadly that's not enough even inside vscode when one has set |
It looks like even hitting Ctrl-S will not abort the existing run to start a new one? At least, I am experiencing extremely high latency (>30s) between hitting Ctrl-S and RA starting a new check run (removing the old diagnostics and starting to add new one) when there is already a check run ongoing (I am in the middle of a big refactoring, so there is hundreds of diagnostics). |
In the rustc repository, "cargo check" can take a long time. During that time, any other
x.py
command is blocked because of the workspace lock. Sometimes, I am doing work where I do not want a full "cargo check" (e.g. when I am just editing a doc comment in libstd, or so). In that case, after doing the edit (which can take less than a minute), I now have to wait several minutes for "cargo check" to complete before I can run doctests (which doesn't need a full "check" of the entire compiler). That is enough friction that I end up using a different editor for this job just to avoid the automatic "cargo check".Is there a way to temporarily (until I close this session, or so) disable "cargo check" in RA? I usually want "check" for the rustc workspace, so a workspace setting doesn't entirely fit here. Just sometimes I want to disable this until I close this workspace again.
The text was updated successfully, but these errors were encountered: