flycheck icon indicating copy to clipboard operation
flycheck copied to clipboard

Rust syntax is only checked on save

Open Visne opened this issue 2 years ago • 4 comments

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:

  1. Open a Rust file with correct syntax.
  2. Make the syntax incorrect by typing random letters into a function call.
  3. No error is shown by Flycheck.
  4. Save the file.
  5. An error is shown by Flycheck.
  6. Fix the error.
  7. The error is still shown by Flycheck.
  8. Save the file.
  9. 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

  1. Open a Rust file with correct syntax.
  2. Make the syntax incorrect by typing random letters into a function call.
  3. An error is shown by Flycheck.
  4. Fix the error.
  5. 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

Visne avatar Jul 06 '22 14:07 Visne

I have the same problem. Note I am using flycheck with lsp-mode + rustic. I can attach some screenshot for clarification: Normal file: Screenshot from 2022-08-01 12-28-15

After having modified the buffer: Screenshot from 2022-08-01 12-28-45

After save (C-x C-s): Screenshot from 2022-08-01 12-35-25

bertulli avatar Aug 01 '22 10:08 bertulli

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.

chubbymomo avatar Apr 08 '23 22:04 chubbymomo

Hmmm... What's the value of flycheck-check-syntax-automatically? Does this happen when flymake + lsp-mode? 🤔

jcs090218 avatar Apr 09 '23 01:04 jcs090218

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!

bertulli avatar Apr 11 '23 23:04 bertulli