diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-10-20 18:17:57 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-10-20 18:17:57 +0200 |
commit | dca7abe79cc4f0933473c3e4bcc75b46cc2c48fd (patch) | |
tree | 577964fff695a536bc2d957889e74a2f9f087290 /runtime | |
parent | 88d3d09e07dbe0e3ea450bc554e2aadc451450d2 (diff) | |
download | vim-git-dca7abe79cc4f0933473c3e4bcc75b46cc2c48fd.tar.gz |
patch 8.1.2192: cannot easily fill the info popup asynchronouslyv8.1.2192
Problem: Cannot easily fill the info popup asynchronously.
Solution: Add the "popuphidden" value to 'completeopt'. (closes #4924)
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/insert.txt | 23 | ||||
-rw-r--r-- | runtime/doc/options.txt | 9 |
2 files changed, 30 insertions, 2 deletions
diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index dfc3541f5..d28bf5998 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 8.1. Last change: 2019 Sep 27 +*insert.txt* For Vim version 8.1. Last change: 2019 Oct 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1138,6 +1138,27 @@ below the text, and the bottom of the menu otherwise. After the info popup is created it can be found with |popup_findinfo()| and properties can be changed with |popup_setoptions()|. + *complete-popuphidden* +If the information for the popup is obtained asynchronously, use "popuphidden" +in 'completeopt'. The info popup will then be initally hidden and +|popup_show()| must be called once it has been filled with the info. This can +be done with a |CompleteChanged| autocommand, something like this: > + set completeopt+=popuphidden + au CompleteChanged * call UpdateCompleteInfo() + func UpdateCompleteInfo() + " Cancel any pending info fetch + let item = v:event.completed_item + " Start fetching info for the item then call ShowCompleteInfo(info) + endfunc + func ShowCompleteInfo(info) + let id = popup_findinfo() + if id + call popup_settext(id, 'async info: ' .. a:info) + call popup_show(id) + endif + endfunc + +< *complete-item-kind* The "kind" item uses a single letter to indicate the kind of completion. This may be used to show the completion differently (different color or icon). Currently these types can be used: diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 8436c8a0d..e62ee8974 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 8.1. Last change: 2019 Sep 28 +*options.txt* For Vim version 8.1. Last change: 2019 Oct 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1919,6 +1919,13 @@ A jump table for the options with a short description can be found at |Q_op|. See |'completepopup'| for specifying properties. {only works when compiled with the |+textprop| feature} + popuphidden + Just like "popup" but initially hide the popup. Use a + |CompleteChanged| autocommand to fetch the info and call + |popup_show()| once the popup has been filled. + See the example at |complete-popuphidden|. + {only works when compiled with the |+textprop| feature} + noinsert Do not insert any text for a match until the user selects a match from the menu. Only works in combination with "menu" or "menuone". No effect if "longest" is present. |