-
-
Notifications
You must be signed in to change notification settings - Fork 968
Description
Is your feature request related to a problem? Please describe.
Remove useless escaping of chars is markdown.
Describe the solution you'd like
Some language servers return escaped characters in markdown. E.g. clangd escapes some characters in text:
[Trace - 11:49:06 AM] Received response 'textDocument/hover - (8)' in 2ms.
Result: {
"contents": {
"kind": "markdown",
"value": "### class `Node` \n\n---\nWrapper for a \\'TSNode\\'\\. Nodes can be named or anonymous \\(see \\[Named vs Anonymous Nodes\\]\\(https\\:\\/\\/tree\\-sitter\\.github\\.io\\/tree\\-sitter\\/using\\-parsers\\#named\\-vs\\-anonymous\\-nodes\\)\\)\\. We are mostly interested in named nodes\\. Nodes can be null \\(check with is\\_null\\)\\. Note\\: This object is only valid for as long as the \\'Tree\\' it was created from\\. If the tree was edited methods on the node might return wrong results\\. In this case you should retrieve the node from the tree again\\. \\'type\\_id\\' is called \\*symbol\\* in Tree\\-Sitter\\. Features not included \\(because we currently don\\'t use them\\)\\: \\- Get child by filed\\: \\- \\`ts\\_node\\_child\\_by\\_field\\_name\\` \\- \\`ts\\_node\\_child\\_by\\_field\\_id\\` \\- Get child\\/decendant for byte\\/point \\(range\\)\\: \\- \\`ts\\_node\\_first\\_child\\_for\\_byte\\` \\- \\`ts\\_node\\_first\\_named\\_child\\_for\\_byte\\` \\- \\`ts\\_node\\_descendant\\_for\\_byte\\_range\\` \\- \\`ts\\_node\\_descendant\\_for\\_point\\_range\\` \\- \\`ts\\_node\\_named\\_descendant\\_for\\_byte\\_range\\` \\- \\`ts\\_node\\_named\\_descendant\\_for\\_point\\_range\\` \\- Editing nodes directly\\: \\- \\`ts\\_node\\_edit\\` \n\n---\n```cpp\n// In namespace ts\nclass Node {}\n```"
},
"range": {
"end": {
"character": 9,
"line": 110
},
"start": {
"character": 5,
"line": 110
}
}
}
Rendered as:
Especially for longer text this is really distracting.
It would be better to remove the uselsss escaping (but it might be hard to detect when the escaping is really useless). Maybe an option to specify a "processor" for the markdown text would be good. Then the user can do exactly what they want and (e.g. also remove links or whatever they want).
Describe alternatives you've considered
This could also be fixed in clangd by not escaping and they have improved this a little (https://reviews.llvm.org/D75687). But I haven't tested this and I think I also saw some other issues that were complaining about the same thing for other language servers.
