-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(cmdline): make completion work for <sid> and s: viml function #925
Conversation
277835a
to
aacb98a
Compare
ping @Saghen |
Does this work with |
Yes, it works just fine. You cannot call a script context function. That’s
why we must call it via getcompletion instead. I don’t understand why we
should call it manually though. Maybe could we delegate to
vim.fn.getcompletion instead?
…On Thu, 9 Jan 2025 at 16:19 Liam Dyer ***@***.***> wrote:
Does this work with <sid> scripts used with input? The motivation for
this getcmdcompltype() code was the following: #696 (comment)
<#696 (comment)>.
I'm not familiar with vimscript but does this case still work with an
<sid> script? I'm likely missing a more elegant solution here (i.e. is
there a vim.fn.getcompletion(_, mode) that gives completions in inputs?)
—
Reply to this email directly, view it on GitHub
<#925 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAYY7LYQ2GVNFLB5L2UU5L2J3DS7AVCNFSM6AAAAABUWUYZ32VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOBRGA3TMMBYGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Try the linked code snippet with |
I'm sorry for the dumb question. Why function! s:LocalAutocomplete(A,L,P) abort
return ['one', 'two', 'three']
endfunction
function! s:StillComplete(A,L,P) abort
return ['one', 'two', 'three']
endfunction
command! -nargs=1 -complete=customlist,s:LocalAutocomplete LocalComplete echo 'oi'
command! -nargs=1 -complete=customlist,<sid>StillComplete StillComplete echo 'oi'
lua =vim.fn.getcompletion("StillComplete ", "cmdline")
" => { "one", "two", "three" } Edit: Oh, I think I got your point. My changes does not break the |
Hmm. Maybe it works because I had to insert an extra space to complete it? This works: lua =vim.fn.getcompletion("StillComplete ", "cmdline") But this won't work: lua =vim.fn.getcompletion("StillComplete", "cmdline") |
Thank you! |
This branch fixes completion issues with commands like
:Rename
in plugins such as vim-eunuch. You can test it by running:Rename
, and the completion should work without errors.The issue was caused by
s:
and<sid>
functions being scoped to their script, which led to errors like:This fix ensures proper handling of these functions, resolving the issue.