Hmm.  It seems too tricky.  How about this more formed idea.

Vim can check type of returned value from completefunc, so vim should
accept not only array but also dictionary.  For array value, vim use it
as same as currently.  For dictionary value, vim behaves some parsing on
it.

For example, 'refresh' means as you wrote, 'candidates' has array of
completion candidates.

    let l = list-with-complete-items
    return { 'refresh': 'always', 'candidates': l }

Besides it is extensible for future use.


2011/9/7 Bram Moolenaar <b...@moolenaar.net>:
>
> Taro Muraoka wrote:
>
>> > Perhaps the complete function should somehow indicate that it
>> > must be called whenever the leader changes.
>>
>> I thought about that too.
>>
>> It would be better that second 'complefunc' option, like
>> 'completefunc2'.  Of course 'completefunc2' prior to 'completefunc' when
>> both of them are set.  Changing the specification of original
>> 'completefunc' causes other problems, like patch#289.
>>
>> How do you think about this idea?  If you feed good, I will start to
>> implement it.
>
> The return value of the function is a list.  We could add a special item
> in the list to indicate the special behavior, but that's weird.
>
> Adding a couple of new options isn't nice either.  But the only
> alternative I can think of right now is setting a variable, which isn't
> nice either.
>
> The least worst solution seems to be to have the function return a first
> element in the list that is a dictionary, and instead of containing a
> "word" item it contains a "refresh" entry.  You could set it to "always"
> to have the function called every time the leader changes.  That leaves
> room for other behavior later.
>
> Thus, at the end of the function:
>
>        let l = list-with-complete-items
>        call insert(l, {'refresh': 'always'})
>        return l
>
> --
> Team-building exercises come in many forms but they all trace their roots back
> to the prison system.  In your typical team-building exercise the employees
> are subjected to a variety of unpleasant situations until they become either a
> cohesive team or a ring of car jackers.
>                                (Scott Adams - The Dilbert principle)
>
>  /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
> ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> \\\  an exciting new programming language -- http://www.Zimbu.org        ///
>  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
>



-- 
MURAOKA Taro <koron.kaor...@gmail.com>

-- 
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

Reply via email to