mirror of
https://github.com/godotengine/godot-vscode-plugin.git
synced 2026-01-05 14:10:13 +03:00
Fix BBCode [br] not rendering in hover (#557)
Fix BBCode [br] not rendering in hover. This is a workaround to the LSP's incorrect concatenation of doc-comments.
This commit is contained in:
@@ -153,6 +153,9 @@ export default class GDScriptLanguageClient extends LanguageClient {
|
||||
// docstrings being displayed as titles
|
||||
value = value.replace(/\n[#]+/g, "\n");
|
||||
|
||||
// fix bbcode line breaks
|
||||
value = value.replaceAll("`br`", "\n\n");
|
||||
|
||||
// fix bbcode code boxes
|
||||
value = value.replace("`codeblocks`", "");
|
||||
value = value.replace("`/codeblocks`", "");
|
||||
|
||||
@@ -398,27 +398,27 @@ function format_documentation(bbcode: string, classname: string) {
|
||||
html = html.replace(match[0], make_codeblock(block, "csharp"));
|
||||
}
|
||||
|
||||
html = html.replaceAll("<br/> ", "");
|
||||
// [param <name>]
|
||||
html = html.replaceAll(
|
||||
/\[param\s+(@?[A-Z_a-z][A-Z_a-z0-9]*?)\]/g,
|
||||
"<code>$1</code>"
|
||||
);
|
||||
// [method <name>]
|
||||
html = html.replaceAll(
|
||||
/\[method\s+(@?[A-Z_a-z][A-Z_a-z0-9]*?)\]/g,
|
||||
`<a href="" onclick="inspect('${classname}', '$1')">$1</a>`
|
||||
);
|
||||
// [<reference>]
|
||||
html = html.replaceAll(
|
||||
/\[(\w+)\]/g,
|
||||
`<a href="" onclick="inspect('$1')">$1</a>` // eslint-disable-line quotes
|
||||
);
|
||||
// [method <class>.<name>]
|
||||
html = html.replaceAll(
|
||||
/\[\w+\s+(@?[A-Z_a-z][A-Z_a-z0-9]*?)\.(\w+)\]/g,
|
||||
`<a href="" onclick="inspect('$1', '$2')">$1.$2</a>` // eslint-disable-line quotes
|
||||
);
|
||||
html = html.replaceAll("<br/> ", "");
|
||||
// [param <name>]
|
||||
html = html.replaceAll(
|
||||
/\[param\s+(@?[A-Z_a-z][A-Z_a-z0-9]*?)\]/g,
|
||||
"<code>$1</code>"
|
||||
);
|
||||
// [method <name>]
|
||||
html = html.replaceAll(
|
||||
/\[method\s+(@?[A-Z_a-z][A-Z_a-z0-9]*?)\]/g,
|
||||
`<a href="" onclick="inspect('${classname}', '$1')">$1</a>`
|
||||
);
|
||||
// [<reference>]
|
||||
html = html.replaceAll(
|
||||
/\[(\w+)\]/g,
|
||||
`<a href="" onclick="inspect('$1')">$1</a>` // eslint-disable-line quotes
|
||||
);
|
||||
// [method <class>.<name>]
|
||||
html = html.replaceAll(
|
||||
/\[\w+\s+(@?[A-Z_a-z][A-Z_a-z0-9]*?)\.(\w+)\]/g,
|
||||
`<a href="" onclick="inspect('$1', '$2')">$1.$2</a>` // eslint-disable-line quotes
|
||||
);
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user