mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
vim-patch:9.0.1708: getcompletion() failes for user-defined commands
Problem: getcompletion() failes for user-defined commands
Solution: set context for completion function
closes: vim/vim#12681
closes: vim/vim#12680
8ef1fbc0c3
Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -296,6 +296,9 @@ const char *set_context_in_user_cmdarg(const char *cmd FUNC_ATTR_UNUSED, const c
|
|||||||
return set_context_in_menu_cmd(xp, cmd, (char *)arg, forceit);
|
return set_context_in_menu_cmd(xp, cmd, (char *)arg, forceit);
|
||||||
}
|
}
|
||||||
if (context == EXPAND_COMMANDS) {
|
if (context == EXPAND_COMMANDS) {
|
||||||
|
if (xp->xp_context == EXPAND_NOTHING) {
|
||||||
|
xp->xp_context = context;
|
||||||
|
}
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
if (context == EXPAND_MAPPINGS) {
|
if (context == EXPAND_MAPPINGS) {
|
||||||
|
@@ -3636,4 +3636,14 @@ func Test_rulerformat_position()
|
|||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_usercmd_completion()
|
||||||
|
let g:complete=[]
|
||||||
|
command! -nargs=* -complete=command TestCompletion echo <q-args>
|
||||||
|
let g:complete = getcompletion('TestCompletion ', 'cmdline')
|
||||||
|
let a = getcompletion('', 'cmdline')
|
||||||
|
|
||||||
|
call assert_equal(a, g:complete)
|
||||||
|
delcom TestCompletion
|
||||||
|
unlet! g:complete
|
||||||
|
endfunc
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
Reference in New Issue
Block a user