From 877861df267a2ad42e4fe5dc89b2c49bd9afbba4 Mon Sep 17 00:00:00 2001 From: Alco Date: Sat, 8 Feb 2025 12:08:50 -0600 Subject: [PATCH 1/5] Add short description and example re `annotations` --- docs/reference/completions.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/reference/completions.md b/docs/reference/completions.md index 8d1fa69c..4eb18c40 100644 --- a/docs/reference/completions.md +++ b/docs/reference/completions.md @@ -82,7 +82,7 @@ is identical to the `contents`: { "trigger": "foo\ttest", "contents": "foobar" } ``` -**trigger** +**trigger** and **annotation** : Text that will be displayed in the completions list and will cause the `contents` to be inserted when chosen. @@ -93,6 +93,12 @@ is identical to the `contents`: slightly grayed and does not affect the trigger itself. + Annotations can also be defined using `annotation`: + +```json +{ "trigger": "foo", "annotation": "test", "contents": "foobar" } +``` + **contents** : Text to be inserted in the buffer. Supports the same string interpolation features From 3a06769cbdda486cde009e2d4fde8badc1c15c91 Mon Sep 17 00:00:00 2001 From: axemonk Date: Sat, 15 Feb 2025 15:08:37 -0600 Subject: [PATCH 2/5] Add completions metadata section --- docs/reference/completions.md | 40 +++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/docs/reference/completions.md b/docs/reference/completions.md index 8d1fa69c..61396bfa 100644 --- a/docs/reference/completions.md +++ b/docs/reference/completions.md @@ -79,7 +79,6 @@ is identical to the `contents`: ```json { "trigger": "foo", "contents": "foobar" }, -{ "trigger": "foo\ttest", "contents": "foobar" } ``` **trigger** @@ -87,12 +86,6 @@ is identical to the `contents`: and will cause the `contents` to be inserted when chosen. - You can use a `\t` tab character - to add an *annotation* for the preceding trigger. - The annotation will be displayed right-aligned, - slightly grayed - and does not affect the trigger itself. - **contents** : Text to be inserted in the buffer. Supports the same string interpolation features @@ -108,3 +101,36 @@ you have to escape it like this: `\\$` (double backslashes are needed because we are within a JSON string). ::: + + +## Completions Metadata + +``` json +{ + "trigger": "func", + "contents": "funcbar", + "annotation": "string", + "kind": "function", + "details": "A short description of what this string function does." +} + +{ "trigger": "func\tstring", "contents": "funcbar" } +``` + +::: info Added in build 4050. + These do not affect the triggers themselves, + but allow for customization of the appearance of completions in the completions list. +::: + +**kind** +: Allows for categorization of the completion via a colored + kind letter to the left of the entry in the completions list. + Colors are determined by the user's color scheme. + +**annotation** +: Displays as right-aligned gray to the right of the entry in the completions list. + Does not affect the trigger itself. + Annotations can also be defined using a tab character `\t` in `trigger`. + +**details** +: Displays at the bottom of the completions list when the entry is highlighted. From 1b4bd92161ab17781d560216453c42aacf9fdcaa Mon Sep 17 00:00:00 2001 From: Alco Date: Sat, 15 Feb 2025 15:16:51 -0600 Subject: [PATCH 3/5] Added completions metadata section --- docs/reference/completions.md | 48 +++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/docs/reference/completions.md b/docs/reference/completions.md index 4eb18c40..61396bfa 100644 --- a/docs/reference/completions.md +++ b/docs/reference/completions.md @@ -79,26 +79,13 @@ is identical to the `contents`: ```json { "trigger": "foo", "contents": "foobar" }, -{ "trigger": "foo\ttest", "contents": "foobar" } ``` -**trigger** and **annotation** +**trigger** : Text that will be displayed in the completions list and will cause the `contents` to be inserted when chosen. - You can use a `\t` tab character - to add an *annotation* for the preceding trigger. - The annotation will be displayed right-aligned, - slightly grayed - and does not affect the trigger itself. - - Annotations can also be defined using `annotation`: - -```json -{ "trigger": "foo", "annotation": "test", "contents": "foobar" } -``` - **contents** : Text to be inserted in the buffer. Supports the same string interpolation features @@ -114,3 +101,36 @@ you have to escape it like this: `\\$` (double backslashes are needed because we are within a JSON string). ::: + + +## Completions Metadata + +``` json +{ + "trigger": "func", + "contents": "funcbar", + "annotation": "string", + "kind": "function", + "details": "A short description of what this string function does." +} + +{ "trigger": "func\tstring", "contents": "funcbar" } +``` + +::: info Added in build 4050. + These do not affect the triggers themselves, + but allow for customization of the appearance of completions in the completions list. +::: + +**kind** +: Allows for categorization of the completion via a colored + kind letter to the left of the entry in the completions list. + Colors are determined by the user's color scheme. + +**annotation** +: Displays as right-aligned gray to the right of the entry in the completions list. + Does not affect the trigger itself. + Annotations can also be defined using a tab character `\t` in `trigger`. + +**details** +: Displays at the bottom of the completions list when the entry is highlighted. From a2e23ccf0b351d17f2cbd1c8661895b726c0483d Mon Sep 17 00:00:00 2001 From: Alco Date: Sat, 15 Feb 2025 15:20:15 -0600 Subject: [PATCH 4/5] Typo fix --- docs/reference/completions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/completions.md b/docs/reference/completions.md index 61396bfa..fe65d260 100644 --- a/docs/reference/completions.md +++ b/docs/reference/completions.md @@ -128,7 +128,7 @@ because we are within a JSON string). Colors are determined by the user's color scheme. **annotation** -: Displays as right-aligned gray to the right of the entry in the completions list. +: Displays as right-aligned gray text to the right of the entry in the completions list. Does not affect the trigger itself. Annotations can also be defined using a tab character `\t` in `trigger`. From d466ea1c92f30f3f93299c09beeb034fa5707942 Mon Sep 17 00:00:00 2001 From: axemonk Date: Sat, 15 Feb 2025 15:34:54 -0600 Subject: [PATCH 5/5] Remove redundant info. --- docs/reference/completions.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/reference/completions.md b/docs/reference/completions.md index 61396bfa..e45dcad6 100644 --- a/docs/reference/completions.md +++ b/docs/reference/completions.md @@ -129,7 +129,6 @@ because we are within a JSON string). **annotation** : Displays as right-aligned gray to the right of the entry in the completions list. - Does not affect the trigger itself. Annotations can also be defined using a tab character `\t` in `trigger`. **details**