You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect/misleading display of descriptions containing exponents #155
Exponents don't display properly in intellisense, hover, etc, so descriptions that have exponents in them display incorrect/misleading values.
Environment
Operating System: Windows 7
JDK version: 1.8.0_102
Visual Studio Code version: 1.9.1
Java extension version: 0.0.10
Steps To Reproduce
Type Integer.MIN_VALUE
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).
@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>"
}
}
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.
VS Code's hover doesn't render superscripts, whether the tag is passed through as HTML or written in flexmark's caret syntax, so the converter can only emit plain text. 2^31-1 is the closest to how people write it. Every alternative either keeps an ambiguity, adds parentheses to the common case (2^(31)-1), or looks worse (a closing caret, or Unicode superscripts that don't cover all characters).
On the specific suggestions: disambiguating x^2y would need parentheses on the token before the sup tag, but the converter streams its output and that text has already been written when the handler runs. Rendering child markup inside a sup tag is for a case that is very rare in javadoc, and it changes how special characters are escaped.
processSup already parenthesizes exponents that aren't a plain number or word, such as 2^(n+1), which covers the case where the ambiguity matters most. If VS Code adds superscript rendering to hovers, this is the one place to revisit.
Activity
fbricon commentedon Feb 22, 2017
So it seems
<sup>31</sup>shouldn't be escaped. I believe this is caused by remark:Remark allows
Customization of allowed HTML tags - not really recommended., so I can see how this is goingKeep sub/sup tags in markdown. Fixes redhat-developer/vscode-java#155
fbricon commentedon Mar 4, 2019
@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.
jrieken commentedon Mar 5, 2019
It's markdown, without support for html. You can use unicode variants, like ², or use the
2^32fbricon commentedon Nov 10, 2021
Might be doable now starting with vscode 1.62:
https://code.visualstudio.com/updates/v1_62?WT.mc_id=devcloud-00000-cxa#_markdownstringsupporthtml
fbricon commentedon Dec 3, 2025
New flexmark-java library renders exponents in a slightly better way
robstryker commentedon Oct 28, 2026
We're leaving the current behavior in main.
VS Code's hover doesn't render superscripts, whether the tag is passed through as HTML or written in flexmark's caret syntax, so the converter can only emit plain text. 2^31-1 is the closest to how people write it. Every alternative either keeps an ambiguity, adds parentheses to the common case (2^(31)-1), or looks worse (a closing caret, or Unicode superscripts that don't cover all characters).
On the specific suggestions: disambiguating x^2y would need parentheses on the token before the sup tag, but the converter streams its output and that text has already been written when the handler runs. Rendering child markup inside a sup tag is for a case that is very rare in javadoc, and it changes how special characters are escaped.
processSup already parenthesizes exponents that aren't a plain number or word, such as 2^(n+1), which covers the case where the ambiguity matters most. If VS Code adds superscript rendering to hovers, this is the one place to revisit.