FittenTech / fittencode.vim

Fitten Code AI Programming Assistant for Vim
63 stars 5 forks source link

fix: return empty string for FittenAccept #25

Closed One-In-Dark closed 1 month ago

One-In-Dark commented 1 month ago

I think a return value of empty string is better than none, for using it in insert mode.

And some minor changes to the README.md and help docs.

BTW, among so many AI programming assistants, this is a pioneer of the few to provide Vim plugin. Many thanks to your contribution!

另:我是中文母语者。出于对GitHub的尊重而使用英语。

arkotters commented 1 month ago

Thank you so much for your valuable contributions.Your commitment and insights are greatly appreciated by the entire team. Let's get back to the code.Could you please share more about your considerations about why you believe return an empty string is better?In order to better evaluate this matter because I’m not quite sure I understand the benefits of doing this for insert mode.

One-In-Dark commented 1 month ago

To use the mapping in insert mode by = register. Like what UltiSnips and coc.nvim suggested. The complete mapping of mine:

inoremap <silent> <Tab>
    \ <C-r>=
    \ Ulti_ExpandOrJump_and_getRes() ? "" :
    \ FittenAcceptable() ? FittenAccept() :
    \ coc#pum#visible() ? coc#pum#confirm() :
    \ IsAfterBlank() ? "\<Tab>" :
    \ coc#refresh()<CR>

At least a return value of empty string should not harm the usage of pure function invoking.

Hopefully these suffice.