mirror of
https://github.com/neovim/neovim.git
synced 2025-10-06 01:46:29 +00:00
@@ -31,6 +31,7 @@ return {
|
||||
'ColorSchemePre', -- before loading a colorscheme
|
||||
'CompleteChanged', -- after popup menu changed
|
||||
'CompleteDone', -- after finishing insert complete
|
||||
'CompleteDonePre', -- idem, before clearing info
|
||||
'CursorHold', -- cursor in same position for a while
|
||||
'CursorHoldI', -- idem, in Insert mode
|
||||
'CursorMoved', -- cursor was moved
|
||||
|
@@ -3594,17 +3594,11 @@ static bool ins_compl_prep(int c)
|
||||
|
||||
auto_format(FALSE, TRUE);
|
||||
|
||||
{
|
||||
const int new_mode = ctrl_x_mode;
|
||||
|
||||
// Trigger the CompleteDone event to give scripts a chance to
|
||||
// act upon the completion. Do this before clearing the info,
|
||||
// and restore ctrl_x_mode, so that complete_info() can be
|
||||
// used.
|
||||
ctrl_x_mode = prev_mode;
|
||||
ins_apply_autocmds(EVENT_COMPLETEDONE);
|
||||
ctrl_x_mode = new_mode;
|
||||
}
|
||||
// Trigger the CompleteDonePre event to give scripts a chance to
|
||||
// act upon the completion before clearing the info, and restore
|
||||
// ctrl_x_mode, so that complete_info() can be used.
|
||||
ctrl_x_mode = prev_mode;
|
||||
ins_apply_autocmds(EVENT_COMPLETEDONEPRE);
|
||||
|
||||
ins_compl_free();
|
||||
compl_started = false;
|
||||
@@ -3630,6 +3624,9 @@ static bool ins_compl_prep(int c)
|
||||
*/
|
||||
if (want_cindent && in_cinkeys(KEY_COMPLETE, ' ', inindent(0)))
|
||||
do_c_expr_indent();
|
||||
// Trigger the CompleteDone event to give scripts a chance to act
|
||||
// upon the end of completion.
|
||||
ins_apply_autocmds(EVENT_COMPLETEDONE);
|
||||
}
|
||||
} else if (ctrl_x_mode == CTRL_X_LOCAL_MSG)
|
||||
/* Trigger the CompleteDone event to give scripts a chance to act
|
||||
|
@@ -130,7 +130,7 @@ func s:CompleteDone_CheckCompletedItemNone()
|
||||
let s:called_completedone = 1
|
||||
endfunc
|
||||
|
||||
function! s:CompleteDone_CheckCompletedItemDict()
|
||||
func s:CompleteDone_CheckCompletedItemDict(pre)
|
||||
call assert_equal( 'aword', v:completed_item[ 'word' ] )
|
||||
call assert_equal( 'wrd', v:completed_item[ 'abbr' ] )
|
||||
call assert_equal( 'extra text', v:completed_item[ 'menu' ] )
|
||||
@@ -138,10 +138,12 @@ function! s:CompleteDone_CheckCompletedItemDict()
|
||||
call assert_equal( 'W', v:completed_item[ 'kind' ] )
|
||||
call assert_equal( 'test', v:completed_item[ 'user_data' ] )
|
||||
|
||||
call assert_equal('function', complete_info().mode)
|
||||
if a:pre
|
||||
call assert_equal('function', complete_info().mode)
|
||||
endif
|
||||
|
||||
let s:called_completedone = 1
|
||||
endfunction
|
||||
endfunc
|
||||
|
||||
func Test_CompleteDoneNone()
|
||||
throw 'skipped: Nvim does not support v:none'
|
||||
@@ -161,7 +163,8 @@ func Test_CompleteDoneNone()
|
||||
endfunc
|
||||
|
||||
func Test_CompleteDoneDict()
|
||||
au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemDict()
|
||||
au CompleteDonePre * :call <SID>CompleteDone_CheckCompletedItemDict(1)
|
||||
au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemDict(0)
|
||||
|
||||
set completefunc=<SID>CompleteDone_CompleteFuncDict
|
||||
execute "normal a\<C-X>\<C-U>\<C-Y>"
|
||||
|
Reference in New Issue
Block a user