dirkwallenstein / vim-localcomplete

Combinable completion functions for Vim
GNU Lesser General Public License v3.0
7 stars 1 forks source link

complete_dictionary_matches differs from i_CTRL-X-CTRL-K #2

Open aaronjensen opened 10 years ago

aaronjensen commented 10 years ago

From looking at the implementation of complete_dictionary_matches I believe it differs in at least two ways from i_CTRL-X_CTRL-K:

From :help 'dictionary':

List of file names, separated by commas, that are used to lookup words for keyword completion commands |i_CTRL-X_CTRL-K|. Each file should contain a list of words. This can be one word per line, or several words per line, separated by non-keyword characters (white space is preferred).

So the problems I see are:

  1. It is currently assumed that there is only one file in dictionary
  2. The regex anchors to ^ instead of non-keyword

That all said, I may be doing something wrong but I wasn't able to get a simple test working w/ localcomplete#dictMatches by setting my completefunc and dictionary.

dirkwallenstein commented 10 years ago

Yes indeed. Both issues exist. Did you see that the dict minimum is 5 chars by default?

On Tue, Mar 4, 2014 at 4:38 PM, Aaron Jensen notifications@github.comwrote:

From looking at the implementation of complete_dictionary_matches I believe it differs in at least two ways from i_CTRL-X_CTRL-K:

From :help 'dictionary':

List of file names, separated by commas, that are used to lookup words for keyword completion commands |i_CTRL-X_CTRL-K|. Each file should contain a list of words. This can be one word per line, or several words per line, separated by non-keyword characters (white space is preferred).

So the problems I see are:

  1. It is currently assumed that there is only one file in dictionary
  2. The regex anchors to ^ instead of non-keyword

That all said, I may be doing something wrong but I wasn't able to get a simple test working w/ localcomplete#dictMatches by setting my completefunc and dictionary.

— Reply to this email directly or view it on GitHubhttps://github.com/dirkwallenstein/vim-localcomplete/issues/2 .

aaronjensen commented 10 years ago

Ah, that's probably what the problem was. I'm curious, why does localcomplete care about the keyword length? It seems like an orthogonal concern, as in, it should be the concern of acp or your combiner function. It seems like if I want to request a specific complete type manually it should work, not fail silently because I haven't given it enough context.

dirkwallenstein commented 10 years ago

You can choose when to add in a completion. When you set dictionary completion to 2 you always have a full completion menu and none of the completions are the word you want to type. So it is useless and in my opinion, just bothers. You can set it to a low value if you like.

On Thu, Mar 6, 2014 at 5:12 AM, Aaron Jensen notifications@github.comwrote:

Ah, that's probably what the problem was. I'm curious, why does localcomplete care about the keyword length? It seems like an orthogonal concern, as in, it should be the concern of acp or your combiner function. It seems like if I want to request a specific complete type manually it should work, not fail silently because I haven't given it enough context.

— Reply to this email directly or view it on GitHubhttps://github.com/dirkwallenstein/vim-localcomplete/issues/2#issuecomment-36823586 .

aaronjensen commented 10 years ago

You can set it to a low value if you like.

Sure, I guess my point was that in out of the box vim you invoke completion when you want it w/ a keypress or two. You would expect it to pop up, even if you have 0 characters.

With ACP, it gets invoked automatically if the meets condition is satisfied. This is where you would handle the minimum character count.

With combinerEXP, it combines things always when it is called so you must do the character limiting in the complete func. If combinerEXP had an equivalent to the meets condition that acp had for each of its functions rather than that concern being built in to the function, then things would be much more flexible. For example, I could use a limit of 2 for local complete in ruby complete, 3 for python complete, and still invoke it manually w/ ctrl-x,ctrl-u when I have only 1 character.

I'm just suggesting that there are two separate concerns that could be separated: 1) completion 2) when to invoke completion.

aaronjensen commented 10 years ago

Of course I recognize I could just set all the limits to 0 and build my own combiner function w/ limits as I see fit, so this isn't a big deal :smile: