zbirenbaum / copilot-cmp

Lua plugin to turn github copilot into a cmp source
MIT License
1.1k stars 39 forks source link

Errors in insert mode when typing since update #8

Closed bashtoni closed 2 years ago

bashtoni commented 2 years ago

Since updating to 00aa1ad I'm seeing this error during typing:

Error executing vim.schedule lua callback: ...e/pack/packer/opt/copilot-cmp/lua/copilot_cmp/source.lua:29: attempt to get length of local 'str_to_remove' (a nil value)
stack traceback:                                                                                                                                                                                                                          
        ...e/pack/packer/opt/copilot-cmp/lua/copilot_cmp/source.lua:29: in function 'remove_string_from_end'                                                                                                                                   
        ...e/pack/packer/opt/copilot-cmp/lua/copilot_cmp/source.lua:41: in function 'clean_insertion'                                                                                                                                          
        ...e/pack/packer/opt/copilot-cmp/lua/copilot_cmp/source.lua:54: in function 'format_and_clean_insertion'                                                                                                                               
        ...e/pack/packer/opt/copilot-cmp/lua/copilot_cmp/source.lua:104: in function 'func'                                                                                                                                                    
        vim/shared.lua:191: in function 'tbl_map'                                                                                                                                                                                              
        ...e/pack/packer/opt/copilot-cmp/lua/copilot_cmp/source.lua:98: in function 'format_completions'                                                                                                                                       
        ...e/pack/packer/opt/copilot-cmp/lua/copilot_cmp/source.lua:122: in function 'handler'  
zbirenbaum commented 2 years ago

Thanks for letting me know. I managed to reproduce by typing at bottom of file. It was because there was no next line to get the text of. Made a check for it, should be fine now.