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

The output of the program is treated as a Rustc diagnostic message #13211

Open
kkshinkai opened this issue Sep 9, 2022 · 2 comments
Open

The output of the program is treated as a Rustc diagnostic message #13211

kkshinkai opened this issue Sep 9, 2022 · 2 comments
Labels
A-vscode vscode plugin issues C-bug Category: bug

Comments

@kkshinkai
Copy link

rust-analyzer version: 0.3.1194-standalone (67920f7 2022-09-04)

rustc version: rustc 1.61.0 (fe5b13d68 2022-05-18)

It seems that RA can't distinguish well between the output of Rust compiler and the output of the program. When I print a string similar to the Rust diagnostic message, VS Code reports it as a Rust error.

I found this problem because I was writing a diagnostic engine similar to Rustc's, and these red lines kept appearing in my test files.

example

To reproduce this issue in VSCode, you need to use the run button on the main function.

@bjorn3
Copy link
Member

bjorn3 commented Sep 9, 2022

This is probably because the problem matcher used to show rustc errors in the editor window doesn't know how to distinguish compiler output from program output.

@kkshinkai
Copy link
Author

I didn't find a way to tell VS Code how to match correctly. I'm not very familiar with VS Code extensions, but I think there's not much more we can do here.

"problemPatterns": [
{
"name": "rustc",
"patterns": [
{
"regexp": "^(warning|warn|error)(?:\\[(.*?)\\])?: (.*)$",
"severity": 1,
"code": 2,
"message": 3
},
{
"regexp": "^[\\s->=]*(.*?):(\\d*):(\\d*)\\s*$",
"file": 1,
"line": 2,
"column": 3
}
]
},

Maybe I should change my program to avoid ambiguity.

@Veykril Veykril added A-vscode vscode plugin issues C-bug Category: bug labels Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-vscode vscode plugin issues C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

3 participants