Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

special characters (<,>,&) not rendered correctly in intellisense preview #479

Closed
danieleades opened this issue Dec 19, 2018 · 13 comments
Closed

Comments

@danieleades
Copy link

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&lt;std::string::String&gt; found type std::option::Option&lt;&amp;std::string::String&gt;
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.

@MattRyder
Copy link

MattRyder commented Dec 22, 2018

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.

@Xanewok
Copy link
Member

Xanewok commented Dec 31, 2018

I believe this is caused upstream by microsoft/vscode@aab56e9#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?

@sandy081
Copy link

sandy081 commented Jan 3, 2019

Created microsoft/vscode#65956 to track and fix this

@Xanewok
Copy link
Member

Xanewok commented Jan 3, 2019

@sandy081 thanks!

@sandy081
Copy link

sandy081 commented Jan 3, 2019

@Xanewok Can you help me in reproducing this issue by providing a sample that creates a diagnostic message with above special characters?

@danieleades
Copy link
Author

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 &amp;'static std::option::Option&lt;&amp;'static str&gt;
         found type &amp;'static strrustc(E0308)

main.rs(2, 14): expected &amp;'static std::option::Option&lt;&amp;'static str&gt; because of return type
main.rs(3, 5): expected enum std::option::Option, found str

@sandy081
Copy link

sandy081 commented Jan 3, 2019

@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.

@Xanewok
Copy link
Member

Xanewok commented Jan 3, 2019

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

b1ds3jx

@sandy081
Copy link

sandy081 commented Jan 3, 2019

@Xanewok Thanks for the sample.

@wiltaylor
Copy link

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.

@chriskrycho
Copy link

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?

@chriskrycho
Copy link

Fixed by microsoft/vscode#65956:

screen shot 2019-01-14 at 8 24 13 am

Updating to latest VS Code (the November 2018 Recovery 2 release) should clear this up for you.

@Xanewok
Copy link
Member

Xanewok commented Jan 14, 2019

Thanks for the report! I'll close this then.

@Xanewok Xanewok closed this as completed Jan 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants