When hovering over issues in the code, the intellisense popup displays some information and the relevant compiler warning. '<', '>', and '&' characters are not rendered properly.
current output-
note: expected type std::option::Option<std::string::String>
found type std::option::Option<&std::string::String>
expected output-
note: expected type std::option::Option<std::string::String>
found type std::option::Option<&std::string::String>
vscode: 1.31.0-insider
rust extension: 0.5.3
rustc: 1.33.0-nightly (it occurs on stable and beta also)
I have tried reinstalling the extension, clearing out ~/.vscode/extensions, apt uninstall --purge code-insiders.
I'm seeing this on vscode 1.30.1, and believe it may be down to this commit reference within this issue.
I'm unsure if this is definite, as I'm a user of vscode and not an extension developer, but it's likely as installing vscode v1.29 fixes the issue.
I believe this is caused upstream by https://github.com/Microsoft/vscode/commit/aab56e95c6beb62e47d355090cc8daa8780ffb09#diff-2ecd3e3a8782a731cedec4ea62cf96c6R232.
@sandy081, who authored the change - we're using backticks in our diagnostic messages for types, which can have special characters such as <, &, as per above. Do you think we could somehow bring back old behaviour upstream and not escape them in `-enclosed strings in MarkdownString?
Created https://github.com/Microsoft/vscode/issues/65956 to track and fix this
@sandy081 thanks!
@Xanewok Can you help me in reproducing this issue by providing a sample that creates a diagnostic message with above special characters?
try this-
fn test() -> &'static Option<&'static str> {
"Hello, World!"
}
fn main() {
}
produces the following output-
mismatched types
expected enum std::option::Option, found str
note: expected type &'static std::option::Option<&'static str>
found type &'static strrustc(E0308)
main.rs(2, 14): expected &'static std::option::Option<&'static str> because of return type
main.rs(3, 5): expected enum std::option::Option, found str
@danieleades Thanks.
But I am asking for sample extension code that can be used to repro this. Means -> Code to create a diagnostic with such message.
Pushed a barebones extension, the offending diagnostic message is here: https://github.com/Xanewok/vscode-diagnostic-repro/blob/a732475fff1b9bd7970f7fdea81b5c9e5c57d483/src/extension.ts#L10.
Steps to run:
$ git clone https://github.com/Xanewok/vscode-diagnostic-repro.git
$ code ./vscode-diagnostic-repro
# Run the extension with F5, notice dummy diagnostic in the first line in every opened file

@Xanewok Thanks for the sample.
Another example of intellisense breaking is when using bit shift operator << it thinks its started a generic type and hilghts all of your code green till it encouters the next >. I have been working around it by putting a comment after it with a //> in it.
FWIW, I'm also seeing the same in the Elm plugin. Did Code change something about how it expects to be handed data around this recently?
Fixed by microsoft/vscode#65956:

Updating to latest VS Code (the November 2018 Recovery 2 release) should clear this up for you.
Thanks for the report! I'll close this then.
Most helpful comment
Fixed by microsoft/vscode#65956:
Updating to latest VS Code (the November 2018 Recovery 2 release) should clear this up for you.