JSON: restore nice-looking tooltips for ctrl+hover

This commit is contained in:
Anton Lobov
2018-11-20 13:13:34 +01:00
parent eed4955809
commit bbab56840c
7 changed files with 15 additions and 10 deletions
@@ -111,14 +111,14 @@ public class JsonSchemaDocumentationProvider implements DocumentationProvider {
return htmlDescription == null
? null
: appendNameTypeAndApi(position, getThirdPartyApiInfo(element, rootSchema), possibleTypes, htmlDescription);
: appendNameTypeAndApi(position, getThirdPartyApiInfo(element, rootSchema), possibleTypes, htmlDescription, preferShort);
}
@NotNull
private static String appendNameTypeAndApi(@NotNull List<JsonSchemaVariantsTreeBuilder.Step> position,
@NotNull String apiInfo,
@NotNull List<JsonSchemaType> possibleTypes,
@NotNull String htmlDescription) {
@NotNull String htmlDescription, boolean preferShort) {
if (position.size() == 0) return htmlDescription;
JsonSchemaVariantsTreeBuilder.Step lastStep = position.get(position.size() - 1);
@@ -131,8 +131,13 @@ public class JsonSchemaDocumentationProvider implements DocumentationProvider {
type = ": " + schemaType;
}
htmlDescription = DocumentationMarkup.DEFINITION_START + name + type + apiInfo + DocumentationMarkup.DEFINITION_END +
DocumentationMarkup.CONTENT_START + htmlDescription + DocumentationMarkup.CONTENT_END;
if (preferShort) {
htmlDescription = "<b>" + name + "</b>" + type + apiInfo + "<br/>" + htmlDescription;
}
else {
htmlDescription = DocumentationMarkup.DEFINITION_START + name + type + apiInfo + DocumentationMarkup.DEFINITION_END +
DocumentationMarkup.CONTENT_START + htmlDescription + DocumentationMarkup.CONTENT_END;
}
return htmlDescription;
}
@@ -1 +1 @@
<div class='definition'><pre>no-reference</pre></div><div class='content'>Disallows /// &lt;reference path=&gt; imports (use ES6-style imports instead)</div>
<b>no-reference</b><br/>Disallows /// &lt;reference path=&gt; imports (use ES6-style imports instead)
@@ -1 +1 @@
<div class='definition'><pre>ccc</pre></div><div class='content'><b>Hello</b> and <font color="blue">enjoy</font> <i>new</i> <a href="http://google.com">description!</a></div>
<b>ccc</b><br/><b>Hello</b> and <font color="blue">enjoy</font> <i>new</i> <a href="http://google.com">description!</a>
@@ -1 +1 @@
<div class='definition'><pre>my_second_level_property</pre></div><div class='content'>my second level property description 1</div>
<b>my_second_level_property</b><br/>my second level property description 1
@@ -1 +1 @@
<div class='definition'><pre>my_property</pre></div><div class='content'>my property description 1</div>
<b>my_property</b><br/>my property description 1
@@ -1 +1 @@
<div class='definition'><pre>source</pre></div><div class='content'>Description found through definition</div>
<b>source</b><br/>Description found through definition
@@ -1 +1 @@
<div class='definition'><pre>source</pre></div><div class='content'>Title found through definition</div>
<b>source</b><br/>Title found through definition