Hi Bram,
On Thu, Dec 9, 2021 at 6:24 AM Bram Moolenaar <[email protected]> wrote:
>
>
> Patch 8.2.3765
> Problem: Vim9: cannot use a lambda for 'opfunc' and others.
> Solution: Convert the lambda to a string.
This doesn't work in some cases. For example:
----------------------------------------------------------------------------
vim9script
def MyomniFunc1(val: number, findstart: number, base: string): any
add(g:MyomniFunc1_args, [val, findstart, base])
return findstart ? 0 : []
enddef
def Test_omnifunc_callback()
var Fn: func = function('s:MyomniFunc1', [14])
&omnifunc = Fn
new | only
setline(1, 'four')
g:MyomniFunc1_args = []
feedkeys("A\<C-X>\<C-O>\<Esc>", 'x')
assert_equal([[14, 1, ''], [14, 0, 'four']], g:MyomniFunc1_args)
bw!
enddef
Test_omnifunc_callback()
----------------------------------------------------------------------------
If you source the above script, it fails with "E119: Not enough
arguments for function: <SNR>15_MyomniFunc1"
Regards,
Yegappan
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/CAAW7x7%3DbOHWoL9H%3DQM8d_Mm6TA8fow6UKs6Tid7gRTLWG0b%2Bsw%40mail.gmail.com.