rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

rust analyzer reports only syntax error.

Open zhaob1n opened this issue 4 years ago • 4 comments

172996007-d7c17dd1-1bb8-4bcd-8b2a-ee6b83119515 I am using latest rustc 1.61.0 and the latest rust-analyzer on macOS 12, when I open an rs file by helix-editor, it will only report syntax error as the picture shows. And if there are no syntax errors, no errors are reported. When I open the file, the red errors signs in line 2 and line 3 appear for 1 second and then disappear. See the video below

https://user-images.githubusercontent.com/52552971/173172117-b40cbc78-bcda-4171-b18d-64317eaa7c69.mov

.

zhaob1n avatar Jun 11 '22 04:06 zhaob1n

the same is for vscode Screen Shot 2022-06-11 at 12 23 35

zhaob1n avatar Jun 11 '22 04:06 zhaob1n

For vscode you didn't save the file. cargo check only runs when you save a file as it can only read files from the disk and not from the memory of your editor.

bjorn3 avatar Jun 11 '22 06:06 bjorn3

For vscode you didn't save the file. cargo check only runs when you save a file as it can only read files from the disk and not from the memory of your editor.

is there a way to use the check without saving? I find the rust official extension in vscode can do such thing.

zhaob1n avatar Jun 11 '22 07:06 zhaob1n

Some things are already checked:

image

I set

    "editor.semanticTokenColorCustomizations": {
        "rules": {
            "unresolvedReference": "#ff0000",
        },
    }

for the red variable and enabled rust-analyzer.diagnostics.experimental.enable for the type mismatch. But both have some false-positives.

We already have https://github.com/rust-lang/rust-analyzer/issues/3107 as a tracking issue for live diagnostics, but it's very long-term.

I find the rust official extension in vscode can do such thing.

The extension you're referring to is now deprecated, and has been unmaintained for a while.

lnicola avatar Jun 11 '22 07:06 lnicola