-
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
rustfmt
on save takes unusually long
#4054
Comments
I also noticed this. I think it happens when RA is busy, but it's even worse when it panics, because the formatter never finishes. @Aloso, maybe check if you have any panics in one of the Output sections. |
@lnicola It seems there was no panic. I added the trace in the issue. |
Same here, but it happens for every edits
Could it be possible to package rust-analyser with symbols so it's easy to debug/profile it? |
I can't reproduce on master, but I reproduce immediately on release. |
@flodiebold I haven't looked into this, but do you have an idea why slow chalk blocked other requests? Could it be the case that some |
Yes, in the recursive solver we probably don't have any cancellation checks. We could add them to the |
Ok so I guess, It is not the same case as mine. I did encounter some 2/3seconds hangs today. |
I have this problem too: can't formatting run in parallel with other RA tasks? There's no reason that "check" should block a file from being saved. |
I have this issue randomly on VSCode on macOS. It is extremely annoying. It can frequently take over a minute for the save to go through. |
This is still occurring. The only thing that seems to help is restarting VSCode entirely, but it doesn't always work. It also seems to occur in batches; some change to code or environment will cause it to occur for some period of time, after which everything runs smoothly once again. |
I'm still getting this, with Rust "1.62.0-nightly (4c60a0ea5 2022-05-04)" and Rust Analyzer 0.3.1051-darwin-arm64. Sometimes the only thing that fixes it is rebooting the entire machine - not just VSCode! :( |
I've met the same problem. At the same time I found Rust-Analyzer extension is upgrading, so I took several minutes for waitting it finish, then problem was solved : ) |
fix: Fix formatting requests hanging when r-a is still starting The reason for that was that we were calculating the crate defmaps of the file we are saving by accident causing us to get stuck waiting on their expensive computation, while we only need the relevant crate id. Closes #4054 Closes #11654
When I open a project in VS Code, modify a file and save, it takes several seconds to format the file:
Invoking
cargo fmt
manually only takes a few milliseconds.The bug only appears when saving a file shortly after opening VS Code, while rust-analyzer is still busy analyzing the project (which takes ~2-3 min for my project).
EDIT:
The trace contains these lines:
Click to see trace
The text was updated successfully, but these errors were encountered: