flycheck
flycheck copied to clipboard
Rust syntax is only checked on save
Checklist
- [x] I have checked existing issues for potential duplicates before creating this one.
- [x] I have read the Troubleshooting guide.
Bug description
Rust syntax is only checked when the file is saved. This means that errors that are already fixed, are still marked in red. Also, this means that code actions can be applied twice, which usually ruins the code instead of fixing it.
Steps to reproduce
Steps to reproduce the behavior:
- Open a Rust file with correct syntax.
- Make the syntax incorrect by typing random letters into a function call.
- No error is shown by Flycheck.
- Save the file.
- An error is shown by Flycheck.
- Fix the error.
- The error is still shown by Flycheck.
- Save the file.
- No error is shown by Flycheck.
- [x] I have read https://emacs.stackexchange.com/questions/28429/how-do-i-troubleshoot-emacs-problems
(tell me if I have to provide a bug recipe, I think it is redundant for this issue)
Expected behavior
- Open a Rust file with correct syntax.
- Make the syntax incorrect by typing random letters into a function call.
- An error is shown by Flycheck.
- Fix the error.
- No error is shown by Flycheck.
System configuration
Syntax checkers for buffer main.rs in rustic-mode:
First checker to run:
lsp (explicitly selected)
- may enable: yes
- may run: t
Checkers that could run if selected:
rustic-clippy select
- may enable: yes
- may run: t
- executable: Found at /usr/bin/cargo
- Clippy: Cannot find the `cargo clippy' command
- Cargo.toml: Found
Flycheck Mode is enabled. Use C-u C-c ! x to enable disabled
checkers.
--------------------
Flycheck version: 33snapshot
Emacs version: 28.1
System: x86_64-pc-linux-gnu
Window system: x
Emacs configuration:
- [x] Plain Emacs / Custom configuration
- [ ] Spacemacs
- [ ] Doom Emacs
- [ ] Other shared configuration
I have the same problem. Note I am using flycheck with lsp-mode + rustic. I can attach some screenshot for clarification:
Normal file:
After having modified the buffer:
After save (C-x C-s
):
Do you have any updates on this issue? I can confirm that I also have this issue when running with flycheck + lsp-mode and rustic.
Hmmm... What's the value of flycheck-check-syntax-automatically
? Does this happen when flymake + lsp-mode? 🤔
Hmmm... What's the value of
flycheck-check-syntax-automatically
?
It is '(save idle-change new-line mode-enabled)
. However, apparently it seems that this is actually expected behaviour, especially on rust-analyzer
's side. So it's not a flycheck issue, I think (for instance with clangd
it semmes to work for me), therefore if you want to close this issue it's ok for me.
Thanks!