TabbyML / vim-tabby

Apache License 2.0
38 stars 2 forks source link

Undefined Variables #8

Closed WaelKarkoub closed 4 months ago

WaelKarkoub commented 5 months ago

Hello,

I'm trying to test out TabbyML running in docker, but I keep getting these errors,

Error detected while processing CursorMovedI Autocommands for "*"..function tabby#OnCursorMoved[1]..<SNR>4
4_GetCompletionContext[1]..<SNR>44_GetLanguage:                                                           
line    2:                                                                                                
E121: Undefined variable: g:tabby_filetype_dict                                                           
Press ENTER or type command to continue                                                                   
Error detected while processing CursorMovedI Autocommands for "*"..function tabby#OnCursorMoved[1]..<SNR>4
4_GetCompletionContext[1]..<SNR>44_GetLanguage:                                                           
line    2:                                                                                                
E116: Invalid arguments for function has_key

My lazy plugin config:

return {
  {
    "TabbyML/vim-tabby",
    event = "BufRead",
    init = function() vim.g.tabby_keybinding_accept = "<Tab>" end,
  },
}

Let me know how I can help

icycodes commented 4 months ago

Hi @WaelKarkoub,

Currently, vim-tabby is designed to be loaded at the VimEnter event and does not support lazy loading. Your config will cause vim-tabby to be loaded at BufRead, which means some global variable initialization will not be done. As a workaround, you can try adding lazy = false. In the future, I will consider improving the initialization flow to support lazy loading. You can also refer to issue #7 for more information.