mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
Add hover actions LSP extension documentation.
This commit is contained in:
parent
7d0dd17b09
commit
da7ec4b339
@ -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
|
||||
+-----------------------------+
|
||||
...
|
||||
```
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user