tbodt / deoplete-tabnine

Deoplete source for TabNine
256 stars 17 forks source link

Does not replace the word starting with number. #13

Closed zgqq closed 5 years ago

zgqq commented 5 years ago

For example, typing "20", then selecting item "2018" according to completion items; instead of "2018", the result is "202018".

Shougo commented 5 years ago

Please test https://github.com/tbodt/deoplete-tabnine/pull/12. It may fix your problem.

Shougo commented 5 years ago

Reproduced. I will fix it.

Shougo commented 5 years ago

self.input_pattern = r'\S*$' causes the problem.

Shougo commented 5 years ago

I think self.input_pattern = r'[^\w\s]$' is better.

@tbodt Ping.

r'\S*$' matches 20| position. So it breaks the complete position.

tbodt commented 5 years ago

[^\w\s] seems like it would trigger the completion only when you type special characters like .. But wouldn't you want it to trigger even on letters, so if you're in the middle of typing a word it can still give you completions?

Shougo commented 5 years ago

Hm... I will add get_complete_position() in #12.

Shougo commented 5 years ago

But wouldn't you want it to trigger even on letters, so if you're in the middle of typing a word it can still give you completions?

It can give the completion. Because, it matches min_pattern_length.

Shougo commented 5 years ago

I have added another get_complete_position() in #12.

https://github.com/tbodt/deoplete-tabnine/pull/12

It fixes the problem. But needs test.