-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Use diagnostic code as link to full message #13853
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
Conversation
|
I'd like to have this message be the default for discoverability purposes. Overall this feature is a hack to get around VSCode's terrible diagnostic UX. So if we could make this a VSCode specific setting that would be the best option right now I think. |
|
I added a setting to control the behavior. |
editors/code/src/client.ts
Outdated
| if (preview) { | ||
| const index = rendered.match(/^(note|help):/m)?.index || 0; | ||
| const index = | ||
| rendered.match(/^ = (note|help):/m)?.index || rendered.length; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why exactly was this changed? The regex is meant to stop at the first note:/help: section, there is no = in front of those
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, can you give an example of what are you trying to filter out?
I though it was this lines:
error[E0308]: mismatched types
--> src/main.rs:3:9
|
2 | let x = 1;
| - expected due to this value
3 | x = vec![1];
| ^^^^^^^ expected integer, found struct `Vec`
|
= note: expected type `{integer}`
found struct `Vec<{integer}>`
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)which have = in front (and 2 spaces).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error[E0038]: the trait `X` cannot be made into an object
--> src\main.rs:2:12
|
2 | let _: Box<dyn X>;
| ^^^^^^^^^^ `X` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> src\main.rs:6:8
|
5 | trait X {
| - this trait cannot be made into an object...
6 | fn foo() -> Self;
| ^^^ ...because associated function `foo` has no `self` parameter
help: consider turning `foo` into a method by giving it a `&self` argument
|
6 | fn foo(&self) -> Self;
| +++++
help: alternatively, consider constraining `foo` so it does not apply to trait objects
|
6 | fn foo() -> Self where Self: Sized;
| +++++++++++++++++
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks,
I changed the regex back.
|
Thanks! |
|
☀️ Test successful - checks-actions |
fixes #13823 by adding a vscode setting that will keeping the existing diagnostic code and use it as a link to the full compiler error message.
While I was there I also fixed
indexto fallback torendered.lengthto make the previewRustcOutput feature work.