LSP hover text markdown links from C# not working

521 views Asked by At

I'm working on a VSCode extension with an LSP (implemented in C#/Omnisharp). I've implemented my language hover provider in the LSP and it's working fine. However, I want to add a clickable [vscode] command link to the hover. I've done this before using markdown in extension Typescript code like [Label](command:some-command), but it's not working from the LSP C# code. From there it just displays flat text as Label, but not as a clickable URI link. If the Uri is a regular https link it works, but not if it's a vscode Uri. Anyone know the magic to enable vscode command links in markdown from LSP C# code?

1

There are 1 answers

0
Matt On

You need to set the markdown content isTrusted flag to get links to work. For a language extension server you need edit the LanguageClientOptions in the client's typescript file.

let clientOptions: LanguageClientOptions = {
    markdown: {
        isTrusted: true,
    },
}

let client = new LanguageClient('myClient', 'My Client', serverOptions, clientOptions);

It's described on their GitHub in this issue