codeium.vim icon indicating copy to clipboard operation
codeium.vim copied to clipboard

Fix completion when user already typed part of suggestion

Open klew opened this issue 2 years ago • 2 comments

strpart function takes "length" as a third parameter. Previous implmentation was using index.

klew avatar Jan 26 '23 12:01 klew

@klew do you happen to have an example completion where this was being buggy for me to test?

pqn avatar Jan 26 '23 17:01 pqn

@pqn I had some troubles in understandnig when this part of code should execute. For sure current code is not correct, because this method expects length as third parameter and, based on context, you wanted to get part of string between two indexes (between two columns).

One simple example where current code (with "cursor_col - 1") gives wrong behavior (set ft=cpp) :


int main(#)

"#" is a cursor. It is important to provide empty line above, because otherwise there are no suggestions. With "cursor_col - 1" it gets ~10 suggestions, but it failes to compare str part and ClearCompletion is called, so nothing is displayed (for majority of suggestions). After change to "cursor_col - col" it works better and display all suggestions with following closing bracket included.

image

klew avatar Jan 27 '23 12:01 klew

Ah I see the problem. I'll try to push a fix for this soon.

pqn avatar Jan 27 '23 23:01 pqn

I think #44 has likely resolved your issues, feel free to check.

pqn avatar Jan 28 '23 11:01 pqn

It fixed that problem I shown in previous comment, however now it seems to interfere too much when I type or use backspace.

During typing, it enters chars at the end of line, then redraw it correctly. During using backspace, it puts remaining part of suggestion to the next line and everything below just "jumps".

Here is short video showing this behavior:

https://user-images.githubusercontent.com/205610/215292979-58f7f4f3-d4ab-4fcf-a919-d2bd1a039533.mp4

klew avatar Jan 28 '23 21:01 klew