Skip to content
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

Checking an exercise takes too long #2071

Open
GlowCheese opened this issue Aug 6, 2024 · 11 comments
Open

Checking an exercise takes too long #2071

GlowCheese opened this issue Aug 6, 2024 · 11 comments
Labels
S-blocked Status: Blocked

Comments

@GlowCheese
Copy link

Description

This is the video that the issue happens:

2024-08-06.23-52-22.mp4

It can be shown that every time I update the code of an exercise, the rust-analyzer builds the whole exercises folder (it has like 156 exercises and the extension run the code check for every single of them). During this process, I cannot use any command (h, n, l or q). Only after it finishes, rustlings tells me if my solution is correct or not and directs me to the next exercise.

I don't think it's a bug, but rather a code design issue. If I turn of rust-analyzer, it seems the issue's gone but I still have to wait for like 1-2 seconds for rustlings to detect file changes.

Please look into this issue and fix it. Thanks!

System Information

  • OS: Windows 10 x64 (10.0.19045)
  • VSCode: version 1.19.0
  • rust-analyzer: 0.3.2062
  • rustlings: 6.1.0
@mo8it

This comment was marked as resolved.

@GlowCheese

This comment was marked as resolved.

@mo8it
Copy link
Contributor

mo8it commented Aug 8, 2024

I reported it in the Rust-Analyzer repo: rust-lang/rust-analyzer#17829

Until this is fixed, I will add a line print showing that Rustlings is running an exercise (not just frozen) and then make a release.

@mo8it mo8it pinned this issue Aug 8, 2024
@senekor

This comment was marked as resolved.

@GlowCheese
Copy link
Author

I reported it in the Rust-Analyzer repo: rust-lang/rust-analyzer#17829

Thanks you so much for handling this issue for me. I'll keep an eye on it to see if I can help with anything!

@senekor senekor mentioned this issue Aug 8, 2024
@mo8it mo8it changed the title rustlings takes lots of time just to detect file changes Checking an exercise takes too long Aug 8, 2024
@mo8it mo8it added the S-blocked Status: Blocked label Aug 8, 2024
@mo8it
Copy link
Contributor

mo8it commented Aug 9, 2024

A message is now shown to indicate that an exercise is being checked so users know that they just need to wait.
You can update to the new version using the following two commands:

rustup update
cargo install rustlings

The actual issue needs to be fixed in Rust-Analyzer now.

@BreadlyUwU
Copy link

BreadlyUwU commented Aug 9, 2024

I think disabling "Check on Save" is a good workaround for now. You can temporarily disable it from VSCode's status bar:
rust-analyzer_vscode

@imaazkhalid
Copy link

I had the same issue on vscode and zed, checked zed's docs
Here's what fixed the issue for me

https://zed.dev/docs/languages/rust#large-projects-and-performance

bors added a commit to rust-lang/rust-analyzer that referenced this issue Aug 23, 2024
fix: run flycheck without rev_deps when target is specified

Since querying for a crate's target is a call to salsa and therefore blocking, flycheck task is now deferred out of main thread by using `GlobalState`s `deferred_task_queue`. Fixes #17829  and rust-lang/rustlings#2071
lnicola pushed a commit to lnicola/rust that referenced this issue Aug 29, 2024
…ykril

fix: run flycheck without rev_deps when target is specified

Since querying for a crate's target is a call to salsa and therefore blocking, flycheck task is now deferred out of main thread by using `GlobalState`s `deferred_task_queue`. Fixes rust-lang#17829  and rust-lang/rustlings#2071
@alibektas
Copy link
Member

This issue can be closed btw :)

@mo8it
Copy link
Contributor

mo8it commented Sep 13, 2024

@alibektas I am afraid that this issue isn't fixed yet. You might have fixed one part of it, but Rust-Analyzer still seems to invalidate everything and check. Here is a video from a Windows VM with only 2 CPU cores.

Screencast.from.2024-09-13.13-41-41.webm

At the beginning of the video, Rust-Analyzer is fully initialized and shows 168 errors and 26 warnings. Then, I press CTRL + s to save the current file without editing it. The number of errors and warnings goes to 0 and then goes up again while Rust-Analyzer says that it is running cargo check. What is it doing here?

After it is done, I edit the file by adding a to the body of the function. The same thing happens again, all errors and warnings are collected again. Towards the end, Rust-Analyzer shows cargo check: if1. if1 is the binary of edited file. So Rust-Analyzer doesn't say that it is checking everything, it only says that it checks the edited binary. But what happens before when only cargo check is displayed? Why does it invalidate all diagnostics and collect them again? Why does it take so long?

I tested it with the stable Rust-Analyzer extension from 09.06. and the pre-release one from 09.12.

This behavior is the same as in the video in the issue description. So I wonder whether rust-lang/rust-analyzer#17912 is applied yet and if it has any effect?

@mo8it
Copy link
Contributor

mo8it commented Sep 13, 2024

The related issue is now rust-lang/rust-analyzer#18110

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked Status: Blocked
Projects
None yet
Development

No branches or pull requests

6 participants