Skip to content

Commit 1dc2761

Browse files
axemonkFichteFoll
authored andcommitted
Add completions metadata section (#121)
Remove redundant info. Add short description and example re `annotations` Added completions metadata section
1 parent 3cba71b commit 1dc2761

File tree

1 file changed

+33
-7
lines changed

1 file changed

+33
-7
lines changed

docs/reference/completions.md

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,13 @@ is identical to the `contents`:
7979

8080
```json
8181
{ "trigger": "foo", "contents": "foobar" },
82-
{ "trigger": "foo\ttest", "contents": "foobar" }
8382
```
8483

8584
**trigger**
8685
: Text that will be displayed in the completions list
8786
and will cause the `contents`
8887
to be inserted when chosen.
8988

90-
You can use a `\t` tab character
91-
to add an *annotation* for the preceding trigger.
92-
The annotation will be displayed right-aligned,
93-
slightly grayed
94-
and does not affect the trigger itself.
95-
9689
**contents**
9790
: Text to be inserted in the buffer.
9891
Supports the same string interpolation features
@@ -108,3 +101,36 @@ you have to escape it like this: `\\$`
108101
(double backslashes are needed
109102
because we are within a JSON string).
110103
:::
104+
105+
106+
## Completions Metadata
107+
108+
``` json
109+
{
110+
"trigger": "func",
111+
"contents": "funcbar",
112+
"annotation": "string",
113+
"kind": "function",
114+
"details": "A short description of what this string function does."
115+
}
116+
117+
{ "trigger": "func\tstring", "contents": "funcbar" }
118+
```
119+
120+
::: info Added in build 4050.
121+
These do not affect the triggers themselves,
122+
but allow for customization of the appearance of completions in the completions list.
123+
:::
124+
125+
**kind**
126+
: Allows for categorization of the completion via a colored
127+
kind letter to the left of the entry in the completions list.
128+
Colors are determined by the user's color scheme.
129+
130+
**annotation**
131+
: Displays as right-aligned gray text to the right of the entry in the completions list.
132+
Does not affect the trigger itself.
133+
Annotations can also be defined using a tab character `\t` in `trigger`.
134+
135+
**details**
136+
: Displays at the bottom of the completions list when the entry is highlighted.

0 commit comments

Comments
 (0)