Add reason to complete function (#529)

fix #528
This commit is contained in:
Lukas Reineke
2021-11-17 01:17:58 +09:00
committed by GitHub
parent 4d800fbcab
commit 17d57f96cc
3 changed files with 14 additions and 6 deletions

View File

@@ -151,7 +151,7 @@ Defines the action of each key mapping. The following lists all the built-in act
- `cmp.mapping.select_prev_item({ cmp.SelectBehavior.{Insert,Select} })`
- `cmp.mapping.select_next_item({ cmp.SelectBehavior.{Insert,Select} })`
- `cmp.mapping.scroll_docs(number)`
- `cmp.mapping.complete()`
- `cmp.mapping.complete({ reason = cmp.ContextReason.{Manual,Auto} })`
- `cmp.mapping.close()`
- `cmp.mapping.abort()`
- `cmp.mapping.confirm({ select = bool, behavior = cmp.ConfirmBehavior.{Insert,Replace} })`: If `select` is true and you haven't select any item, automatically selects the first item.
@@ -508,10 +508,13 @@ NOTE: The `preselected` entry does not returned from this method.
Confirms the current selected item, if possible. If `select` is true and no item has been selected, selects the first item.
#### `cmp.complete()`
#### `cmp.complete({ reason = cmp.ContextReason.{Manual,Auto} })`
Invokes manual completion.
NOTE: manual completion overrules some checks autocompletion does like `keyword_length`.
To make it behave like autocompletion instead, you can overwrite the reason in the argument.
#### `cmp.close()`
Closes the current completion menu.