redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.08k stars 434 forks source link

Incorrect/misleading display of descriptions containing exponents #155

Open elirnm opened 7 years ago

elirnm commented 7 years ago

Exponents don't display properly in intellisense, hover, etc, so descriptions that have exponents in them display incorrect/misleading values.

Environment
Steps To Reproduce
  1. Type Integer.MIN_VALUE
  2. Notice that both the autocompletion while typing and the tooltip from hovering over the name say that the minimum value of an int is -231 rather than the -231 present in the Java documentation.

Integer.MAX_VALUE does the same thing on hover (231-1 rather than 231-1) but also adds a slash in the autocompletion dialog (231\-1).

capture

fbricon commented 7 years ago

So it seems <sup>31</sup> shouldn't be escaped. I believe this is caused by remark:

 Remark passes the HTML to jsoup, to clean up the input text, which strips unsupported HTML tags (the text will remain)

Remark allows Customization of allowed HTML tags - not really recommended., so I can see how this is going

fbricon commented 5 years ago

@jrieken @aeschli I tried to return MarkedContent instead of MarkedString, but the sup/sub tags are still not rendered properly. Am I missing something? I thought this would be possible by now.

[Trace - 3:54:26 PM] Received response 'textDocument/hover - (38)' in 29ms.
Result: {
    "contents": {
        "kind": "markdown",
        "value": "Content model element which abstracts attribute declaration from a given grammar (XML Schema, DTD). x<sup>x+1</sup>. x<sub>i+1</sub>"
    }
}
screen shot 2019-03-04 at 4 04 12 pm
jrieken commented 5 years ago

It's markdown, without support for html. You can use unicode variants, like ², or use the 2^32

fbricon commented 2 years ago

Might be doable now starting with vscode 1.62:

The new supportHtml property on MarkdownString enables rendering of a safe subset of raw HTML that appears inside the Markdown text. The supportHtml property defaults to false. When disabled, VS Code will strip out any raw HTML tags that appear in the Markdown text.

https://code.visualstudio.com/updates/v1_62?WT.mc_id=devcloud-00000-cxa#_markdownstringsupporthtml