diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index 7f7940d0b6..a0847dad3a 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md @@ -467,3 +467,41 @@ interface InlayHint { label: string, } ``` + +## Hover Actions + +**Client Capability:** `{ "hoverActions": boolean }` + +If this capability is set, `Hover` request returned from the server might contain an additional field, `actions`: + +```typescript +interface Hover { + ... + actions?: CommandLinkGroup[]; +} + +interface CommandLink extends Command { + /** + * A tooltip for the command, when represented in the UI. + */ + tooltip?: string; +} + +interface CommandLinkGroup { + title?: string; + commands: CommandLink[]; +} +``` + +Such actions on the client side are appended to a hover bottom as command links: +``` + +-----------------------------+ + | Hover content | + | | + +-----------------------------+ + | _Action1_ | _Action2_ | <- first group, no TITLE + +-----------------------------+ + | TITLE _Action1_ | _Action2_ | <- second group + +-----------------------------+ + ... +``` \ No newline at end of file diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index 9df6702839..f2094b5cef 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts @@ -66,7 +66,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient // Workaround to support command links (trusted vscode.MarkdownString) in hovers // https://github.com/microsoft/vscode/issues/33577 hover.contents = hover.contents.map(toTrusted); - + const actions = (result).actions; if (actions) { hover.contents.push(renderHoverActions(actions));