Rust-analyzer in VSCode doesn't provide error info in real time

Recently I've been learning rust language, and thus I installed rust-analyzer in VSCode. But when I wrote an incorrect code, there wasn't any error message until I pressed CTRL+S to save the file.

Before saving the file:

Does anyone know the method to show error message real-time without saving the file? Thanks very much!

rust-analyzer can only show certain errors on-the-fly, like syntax errors. The rest go through cargo check, which (I think?) requires the file to be saved. You can turn on autosave or learn to mash ctrl-s to get faster errors.

1 Like

I turned on auto-save and it's nearly-real-time now! Thank you very much :smiling_face_with_three_hearts:


FYI just in case auto-save bites you later on, and you decide to disable it.... you might also consider mapping a keyboard shortcut to the Save All Files command. On my system, it doesn't appear to have a default mapping.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.