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

rust analyzer reports only syntax error. #12503

Closed
xcpky opened this issue Jun 11, 2022 · 4 comments
Closed

rust analyzer reports only syntax error. #12503

xcpky opened this issue Jun 11, 2022 · 4 comments

Comments

@xcpky
Copy link

xcpky commented Jun 11, 2022

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
172997535-ad817385-75f0-4a32-8914-26ac8312ea74.mov

.

@xcpky xcpky changed the title rust analyzer reports only syntax error in helix-editor. rust analyzer reports only syntax error. Jun 11, 2022
@xcpky
Copy link
Author

xcpky commented Jun 11, 2022

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

@bjorn3
Copy link
Member

bjorn3 commented Jun 11, 2022

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.

@xcpky
Copy link
Author

xcpky commented Jun 11, 2022

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.

@lnicola
Copy link
Member

lnicola commented Jun 11, 2022

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 #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.

@xcpky xcpky closed this as completed Jun 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants