Open dwexel opened 3 months ago
I needed a similar conversion as part of a plugin I was working on, so I fully agree. The LSP specs also specify GFM as their markdown syntax, so this is indeed the one that should be implemented here.
The issue is that there are multiple BBCode flavors in Godot:
So if we wanted to expose this to scripting, it might be expected that it supports flavor 1, but in reality we want to implement flavor 2 for our purposes here. Maybe for starters, it should be a private implementation for flavor 2, until there is actual demand to make such a feature available to scripts as well.
Needs some research to check how links that reference members, classes, enums etc. should be formatted, so that the VSCode extension for example could open the built-in documentation viewer, or jump to the corresponding implementation file.
For formatting links to a built-in documentation viewer: one way to handle this gracefully is to add a boolean option to the initializeOptions in the initialize request that informs the language server wether the client is able to handle in-editor documentation pages. If enabled, the language server can use a custom URI scheme. For languages that don’t support a built-in viewer, the language server can use plain https:// URI schemes that point to documentation available online.
Editor clients can then parse the URI and if it’s of the custom scheme type redirect to their in-editor viewer.
I've investigated the BBCode flavors, and they're handled completely separately. One in RichTextLabel::append_text
and one in EditorHelp::_add_text_to_rt
. I even found yet another parser in mono's BindingsGenerator::bbcode_to_text
.
I believe this proposal should not be solved by creating a fourth parser for this purpose, but instead refactor all of these into one BBCode parser class that returns a list of tokens (or as RichTextLabel calls them Items). This would then be used for all BBCode flavors, as long as it is configurable enough to make it work.
I opened #10339 with a proposal on a possible way to approach this.
Describe the project you are working on
I'm working on a game; I'm using and developing a sublime text add-on in order to help make my game. Sublime text supports LSP and I've been able to use it with Godot's LSP server.
Describe the problem or limitation you are having in your project
Godot returns markdown formatted (with BBCode?) for documentation popups/tooltips/whatyoucallthem
for example;
which results in this misprint
Describe the feature / enhancement and how it helps to overcome the problem or limitation
The Godot language server implementation might be changed. if godot wants to use a custom format for docstrings that's fine, but it shouldn't be on individual (LSP) client implementations to adapt to that
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Godot could instead return messages with the standard code block markdown syntax
or something like it??
If this enhancement will not be used often, can it be worked around with a few lines of script?
it's already being worked around in the official pugin for vscode
Is there a reason why this should be core and not an add-on in the asset library?
Because other non-engine third parties will be building on top of this change, and it's a very small and straightforward chagen