zbirenbaum / copilot.lua

Fully featured & enhanced replacement for copilot.vim complete with API for interacting with Github Copilot
MIT License
2.43k stars 64 forks source link

Unknown function `strutf16len` for nvim 0.9.4 #243

Closed lassepe closed 7 months ago

lassepe commented 7 months ago

When running copilot.lua on nvim 0.9.4, I get the following error upon expanding a suggestion:

E5108: Error executing lua: Vim:E117: Unknown function: strutf16len                                                                                                       
stack traceback:                                                                                                                                                          
        [C]: in function 'strutf16len'                                                                                                                                    
        ...l/share/nvim/lazy/copilot.lua/lua/copilot/suggestion.lua:463: in function 'fn'                                                                                 
        ...l/share/nvim/lazy/copilot.lua/lua/copilot/suggestion.lua:32: in function 'with_client'                                                                         
        ...l/share/nvim/lazy/copilot.lua/lua/copilot/suggestion.lua:460: in function <...l/share/nvim/lazy/copilot.lua/lua/copilot/suggestion.lua:445>        

The offending line seems to be this:

https://github.com/zbirenbaum/copilot.lua/blob/15004980c2fa03bbcdb2b036bf5aac25e4d1a193/lua/copilot/util.lua#L304

Specifically, vim.fn.strutf16len is truethy but not callable. Commenting out this function override symptomatically fixes the issue.

nskeip commented 7 months ago

Seems like it's not just unknown (because the workaround was provided), but it looks like the workaround has a bug, see https://github.com/zbirenbaum/copilot.lua/commit/49860bd8e6f4f5ab18763038c35edd0eae521480#commitcomment-133723717

nskeip commented 7 months ago

fixed in 2b974b49b975384117e09d0e953e992a30e2bd64