Don't use code annotations unconditionally for related diagnostics#49319
Don't use code annotations unconditionally for related diagnostics#49319jrieken merged 2 commits intomicrosoft:masterfrom
Conversation
|
Looking good. Thanks.
Yeah, I think for now VS Code should escape markdown syntax because the type is just a string. The API does spec the |
And yeah, I think we should sanitise and if you wanna update this PR that would be awesome. We don't have a reusable util-function but this: https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/api/node/extHostTypes.ts#L983 from which you could do some copying. |
I was lying... You can use |
| `* [${basename(resource.path)}(${startLineNumber}, ${startColumn})](${resource.toString(false)}#${startLineNumber},${startColumn}): ${message} \n` | ||
| `* [${basename(resource.path)}(${startLineNumber}, ${startColumn})](${resource.toString(false)}#${startLineNumber},${startColumn}): ` | ||
| ); | ||
| hoverMessage.appendText(`${message}`); |
There was a problem hiding this comment.
Uh, I just realized - I guess this could be just written as hoverMessage.appendText(message);?
|
Merging, looking good. Thanks 👏 |
|
Thanks! |

Apparently fixes #46713.
First of all, thank you for your work on related information! That seems like a huge boon for Rust users, where the diagnostics emitted by the compiler often have multiple spans. It's nifty to see them logically grouped in VSCode!
I noticed that the related information messages unconditionally use code formatting. That doesn't seem consistent with regular diagnostic messages and also
rustcemits messages containing backticks when referring to code, which would benefit further from using the message verbatim.I tried to nail it down, the effects can be seen here:
Before:

After:

Is the fix good or should we sanitize and disable markdown rendering for related information, like it's done for primary diagnostic message? (It'd be great to opt-in into primary diagnostic message rendered as markdown as well, but that's another thing)