ncm2 / ncm2-syntax

syntax source for ncm2
MIT License
5 stars 0 forks source link

feature request: add option to only complete full words #2

Closed leotaku closed 6 years ago

leotaku commented 6 years ago

This might also be a bug, but when I use ncm2-syntax I sometimes get the following completion: maim-2018-08-28-12 11 57

This to me seems like unwanted behavior, I think it would be more intuitive if ncm2-syntax only tried to complete entire words did not start matching in the middle of them.

jsfaint commented 6 years ago

It's not issue in ncm2-syntax, it's a feature of ncm2 matcher. The default matcher is abbrfuzzy

It you set with this

let g:ncm2#matcher = 'prefix'

You will got what you want.

But you are right, the prefix matcher is more intuitive, so I rewrite the matcher of ncm2-syntax. 😄

jsfaint commented 6 years ago

😢 Oh no, I found that I just re-event the wheel, ncm2 already provides the ncm2#override_source() API, the only thing you need is add this into your vimrc

call ncm2#override_source('syntax', {'matcher': 'prefix'})

I just removed that stupid commit. 😭

leotaku commented 6 years ago

Hmmm..., maybe I am missing something, but this doesn't seem to work for me. I have:

call ncm2#override_source('syntax', {'matcher': 'prefix'})

inside my .vimrc, but still get 'wrong' completion.

I however think that I have found out what is going on:

The completion source only starts treating letters as the word it is expected to complete when it is past the complete length.

with complete_length=[[1, 3]]:

so|m
   map
   mop
   meow

with complete_length=[[1, 6]]:

anyth|i
      iter
      imap

I am pretty sure this is a bug.

jsfaint commented 6 years ago

I tried with bash, go and c, and I can't reproduce it anymore. Which language do you use and can you provide the minimal vimrc to reproduce it?

leotaku commented 6 years ago

This was fixed by updating to the latest ncm2-syntax version. Because you said you undid your commit addressing this problem it did not occur to me that I had to update. Sorry for wasting your time.

jsfaint commented 6 years ago

@LeOtaku No, thank you! I tried to fix this issue once before in commit 8007abf3b231ea25889d85bbc831ed6c320926b7, but it look the issue is still there. Thanks for your help 👍 Maybe we can close this issue now?

leotaku commented 6 years ago

Yes, by my testing this is fixed now.