Add hover actions LSP extension documentation.

This commit is contained in:
vsrs 2020-06-03 14:34:11 +03:00
parent 7d0dd17b09
commit da7ec4b339
2 changed files with 39 additions and 1 deletions

View File

@ -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
+-----------------------------+
...
```

View File

@ -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 = (<any>result).actions;
if (actions) {
hover.contents.push(renderHoverActions(actions));