Formatting documentation strings in hover popups.
See original GitHub issueThe JSON language server supports markdown formatted docstrings, which enables us to write nice looking popups such as:

Can LemMinX do something like that as well?
It appears all <xs:documentation> contents is streamed as unformatted plain text with all kinds of whitespace and newlines etc. removed. So even plain text formatted docstring as the one from the following example result in poor user experience at the moment.
Result

Source
<xs:annotation>
<xs:documentation>
See http://www.w3.org/XML/1998/namespace.html and
http://www.w3.org/TR/REC-xml for information about this namespace.
This schema document describes the XML namespace, in a form
suitable for import by other schema documents.
Note that local names in this namespace are intended to be defined
only by the World Wide Web Consortium or its subgroups. The
following names are currently defined in this namespace and should
not be used with conflicting semantics by any Working Group,
specification, or document instance:
base (as an attribute name): denotes an attribute whose value
provides a URI to be used as the base for interpreting any
relative URIs in the scope of the element on which it
appears; its value is inherited. This name is reserved
by virtue of its definition in the XML Base specification.
lang (as an attribute name): denotes an attribute whose value
is a language code for the natural language of the content of
any element; its value is inherited. This name is reserved
by virtue of its definition in the XML specification.
space (as an attribute name): denotes an attribute whose
value is a keyword indicating what whitespace processing
discipline is intended for the content of the element; its
value is inherited. This name is reserved by virtue of its
definition in the XML specification.
Father (in any context at all): denotes Jon Bosak, the chair of
the original XML Working Group. This name is reserved by
the following decision of the W3C XML Plenary and
XML Coordination groups:
In appreciation for his vision, leadership and dedication
the W3C XML Plenary on this 10th day of February, 2000
reserves for Jon Bosak in perpetuity the XML name
xml:Father
</xs:documentation>
</xs:annotation>
What the client receives is:
:: --> LemMinX textDocument/hover(583): {'textDocument': {'uri': 'file:///C:/Apps/Sublime%20Text/Data/Packages/Markdown%20Extras/Snippets/Link.sublime-snippet'}, 'position': {'line': 2, 'character': 5}}
:: <<< LemMinX 583: {'contents': {'value': 'See http://www.w3.org/XML/1998/namespace.html and http://www.w3.org/TR/REC-xml for information about this namespace. This schema document describes the XML namespace, in a form suitable for import by other schema documents. Note that local names in this namespace are intended to be defined only by the World Wide Web Consortium or its subgroups. The following names are currently defined in this namespace and should not be used with conflicting semantics by any Working Group, specification, or document instance: base (as an attribute name): denotes an attribute whose value provides a URI to be used as the base for interpreting any relative URIs in the scope of the element on which it appears; its value is inherited. This name is reserved by virtue of its definition in the XML Base specification. lang (as an attribute name): denotes an attribute whose value is a language code for the natural language of the content of any element; its value is inherited. This name is reserved by virtue of its definition in the XML specification. space (as an attribute name): denotes an attribute whose value is a keyword indicating what whitespace processing discipline is intended for the content of the element; its value is inherited. This name is reserved by virtue of its definition in the XML specification. Father (in any context at all): denotes Jon Bosak, the chair of the original XML Working Group. This name is reserved by the following decision of the W3C XML Plenary and XML Coordination groups: In appreciation for his vision, leadership and dedication the W3C XML Plenary on this 10th day of February, 2000 reserves for Jon Bosak in perpetuity the XML name xml:Father\r\n\r\nSource: [sublime-snippet.xsd](file:/C:/Apps/Sublime%20Text/Data/Packages/LSP-lemminx/catalogs/sublime/sublime-snippet.xsd)', 'kind': 'markdown'}, 'range': {'start': {'line': 2, 'character': 3}, 'end': {'line': 2, 'character': 13}}}
Note: I injected the content into an XSD called sublime-snippet.xsd which I am working on in order to provide intelligence features to write Sublime Text / TextMate resources.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:13 (7 by maintainers)
Top Results From Across the Web
On Hover Doc String Formatting Lacks Linebreaks #42 - GitHub
Line breaks between parameters are not being printed in the hover over signature and docstring. See screenshot below: Line breaks between ...
Read more >How can I make the documentation pop-up on hover in ...
Instead, to show the doc hovered near the mouse, right-click on the header of the Documentation tool window and select Open as popup...
Read more >Hover text and formatting in R - Plotly
Detailed examples of Hover Text and Formatting including changing color, size, log axes, and more in R.
Read more >Use advanced formatting—ArcGIS Dashboards | Documentation
Format lists ; separatorColor. String. Bottom border color of the line item ; selectionTextColor. String. Color used for line item text when the...
Read more >Pop-ups: Text Element Essentials - Esri
Pop-ups are created by configuring and adding content elements. ... add links, use HTML, and use formatting tools to format the text. Hover...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hmm.
With a bit of luck and playing around I managed to create something like:
But the required XML code looks a bit uncommon. Some tokens need to be escaped even twice (e.g.:
&lt;).Things get a bit better by wrapping the content into CDATA.
I haven’t found any other XSD file doing so, which makes me think it is not intended to be needed.
Haven’t investigated in detail what’s going on, but it seems
In short. I am not familiar with XML standard with regards to handling such doc strings but it looks like there is one conversion step too much taking place.
What I’d expect to produce the desired result is:
or maybe tags which are to be sent as is escaped with entities.
Almost no Markdown renderers do that for obvious reasons, including VSCode.
This all seems to be a big mess and I didn’t follow all of the above conversation but I can confirm that the CDATA technique mentioned above works fine in VSCode and it’s not too ugly: