Using monaco-editor v0.14.3, we have set up a JSON editor, based on a JSON schema, like this:
monaco.languages.json.jsonDefaults.setDiagnosticsOptions(
{
validate: true,
allowComments: true,
schemas:
[
{
uri: "https://server/schema.json",
fileMatch: ["*.json"],
schema: schema
}]
});
where schema is a JSON schema object, for which the description property is defined for every property in the schema. This description property contains some HTML tags, and when hovering the JSON editor, this description is shown without interpreting the HTML tags, which displays something like "This property <b>defines</b> the way…".
We have looked in the direction of the monaco.languages.registerHoverProvider() method, in order to provide the hover text ourselves, but cannot access to the default hover mechanism, which computes the default JSON schema property, so as to customize it and turn the HTML into Markdown: is it possible to access to the description in the JSON schema related to the hovered text?
In addition, when modifying the JSON schema description property by using Markdown or HTML, the built-in hovering keeps on interpreting this field as raw text: is it possible to force the default hovering system to interpret in as Markdown or HTML?
Thanks to the guys from Monaco, there is an undocumented property named markdownDescription which the JSON language service uses instead of the description. This isn't standard, but it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With