aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/vim.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-12-16 12:41:05 +0100
committerGitHub <noreply@github.com>2023-12-16 12:41:05 +0100
commit5ed55ff14c8b7e346811cb6228bf63fb5106bae9 (patch)
treed27158d56da5810b942a3d561ae15b2711b2a7cd /src/nvim/api/vim.c
parent7e7da962de404e3a0952bcc0adc6fbe53eda3cfb (diff)
parente38027ef69f75653ee953b16ebf4a8652a3fb748 (diff)
downloadrneovim-5ed55ff14c8b7e346811cb6228bf63fb5106bae9.tar.gz
rneovim-5ed55ff14c8b7e346811cb6228bf63fb5106bae9.tar.bz2
rneovim-5ed55ff14c8b7e346811cb6228bf63fb5106bae9.zip
Merge pull request #24723 from glepnir/popup
feat(complete): completeopt support popup like vim
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r--src/nvim/api/vim.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 2f3d527b9e..91f908bb88 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -2300,3 +2300,29 @@ void nvim_error_event(uint64_t channel_id, Integer lvl, String data)
// if we fork nvim processes as async workers
ELOG("async error on channel %" PRId64 ": %s", channel_id, data.size ? data.data : "");
}
+
+/// Set info for the completion candidate index.
+/// if the info was shown in a window, then the
+/// window and buffer ids are returned for further
+/// customization. If the text was not shown, an
+/// empty dict is returned.
+///
+/// @param index the completion candidate index
+/// @param opts Optional parameters.
+/// - info: (string) info text.
+/// @return Dictionary containing these keys:
+/// - winid: (number) floating window id
+/// - bufnr: (number) buffer id in floating window
+Dictionary nvim_complete_set(Integer index, Dict(complete_set) *opts)
+ FUNC_API_SINCE(12)
+{
+ Dictionary rv = ARRAY_DICT_INIT;
+ if (HAS_KEY(opts, complete_set, info)) {
+ win_T *wp = pum_set_info((int)index, opts->info.data);
+ if (wp) {
+ PUT(rv, "winid", WINDOW_OBJ(wp->handle));
+ PUT(rv, "bufnr", BUFFER_OBJ(wp->w_buffer->handle));
+ }
+ }
+ return rv;
+}