Skip to content

Make panic error shown on code optional. #14977

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

Closed
adrianos42 opened this issue Jun 4, 2023 · 6 comments · Fixed by #15186
Closed

Make panic error shown on code optional. #14977

adrianos42 opened this issue Jun 4, 2023 · 6 comments · Fixed by #15186
Labels
A-vscode vscode plugin issues C-feature Category: feature request

Comments

@adrianos42
Copy link

adrianos42 commented Jun 4, 2023

It would be interesting to have an option not to show runtime errors as an error in the code.

@adrianos42 adrianos42 added the C-feature Category: feature request label Jun 4, 2023
@HKalbasi
Copy link
Member

HKalbasi commented Jun 4, 2023

Duplicate of #14193

Note that server panics are always considered a bug, so you can also report that with a stack trace and optionally a repro.

@HKalbasi HKalbasi closed this as not planned Won't fix, can't repro, duplicate, stale Jun 4, 2023
@adrianos42
Copy link
Author

Sorry if I didn't specify. Apparently it's related to this new feature: 14749. It was introduced in the 0.3.1506 version, changelog number 180.

@HKalbasi
Copy link
Member

HKalbasi commented Jun 4, 2023

Ah, sorry I misunderstood the issue.

@HKalbasi HKalbasi reopened this Jun 4, 2023
@HKalbasi HKalbasi added the A-vscode vscode plugin issues label Jun 5, 2023
@apollo-sturdy
Copy link

+1. Since this update I am often confused to see red text in my file names and assume I have a compilation error, and instead just find that it is an error from a very old test run that has since been fixed. Is there already a way to clear these errors?

@tooltitude-support
Copy link

It would also be nice to indicate that it's rust-analyzers' error message. The source is shown as panic which is not very easy to understand.

@dnut
Copy link

dnut commented Jun 30, 2023

The utility of this feature is not worth the violation of what we usually take for granted about "problem" highlighting. Highlighting errors directly in the code serves some important roles, such as:

  1. Telling you that something is definitely invalid and can never run without error.
  2. Accurately representing the code exactly as it is written right now.
  3. Providing immediate feedback about code that you just typed, within the context where you are working, so you don't need to jump to another context and compile or run the code from scratch.

All three of these principles are violated by this feature.

  1. Your code might be perfectly fine, and the panic was triggered by something unrelated to your code having any problems.
  2. As soon as you change the code, the problem is no longer valid. It may not even be possible for your code to panic in that location. Yet, the error never goes away, until you run the code without any errors, which is not always practical.
  3. You will be looking at the terminal output regardless to understand the error. In that context, you can click on the stack trace to bring you to the exact location of the error.

When something I trust refuses to stop demanding my attention, it's hard to concentrate. I trust it and take it seriously because it usually means there is definitely something wrong with my code. I may learn to ignore error highlighting after I get desensitized to perpetual red herrings. That would be unfortunate.

I can imagine a variant of this feature that would be acceptable. It should...

  • A. be easy to completely disable.
  • B. immediately disappear as soon as any code files are written to.
  • C. not be a "problem" that looks like a compiler error in the editor. It should have a completely different appearance that is less alarming.

I don't think any feature like this should be in rust-analyzer at all unless it satisfies either A or both B and C.

matklad added a commit to matklad/rust-analyzer that referenced this issue Jun 30, 2023
To re-enable this, use

    "rust-analyzer.runnables.problemMatcher": [
        "$rustc",
        "$rust-panic"
    ],

setting.

closes: rust-lang#14977
bors added a commit that referenced this issue Jul 3, 2023
feat: don't add panics to error jump list by default

To re-enable this, use

    "rust-analyzer.runnables.problemMatcher": [
        "$rustc",
        "$rust-panic"
    ],

setting.

closes: #14977
@bors bors closed this as completed in 832a64e Jul 3, 2023
joshrotenberg pushed a commit to joshrotenberg/rust-analyzer that referenced this issue Jul 13, 2023
To re-enable this, use

    "rust-analyzer.runnables.problemMatcher": [
        "$rustc",
        "$rust-panic"
    ],

setting.

closes: rust-lang#14977
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-feature Category: feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants