hrsh7th / cmp-cmdline

nvim-cmp source for vim's cmdline
MIT License
550 stars 42 forks source link

Does not support completion in the presence of non-string globals #50

Open j-hui opened 2 years ago

j-hui commented 2 years ago

Not sure if this is problem with Neovim's own getcompletion() function or the way this plugin is using it, but it starts throwing errors when I set a global variable whose key is not a string.

Steps to reproduce:

Setup cmp-cmdline completion.

Execute:

:lua _G[{}] = true

Then start typing another lua command from the command line. I get the following error:

Error executing vim.schedule lua callback: Vim:Error executing vim._expand_pat: attempt to compare table with string
stack traceback:
        [C]: in function 'sort'
        vim/_editor.lua: in function <vim/_editor.lua:0>
        [C]: in function 'getcompletion'
        ...e/pack/packer/start/cmp-cmdline/lua/cmp_cmdline/init.lua:68: in function 'exec'
        ...e/pack/packer/start/cmp-cmdline/lua/cmp_cmdline/init.lua:115: in function 'complete'
        .../nvim/site/pack/packer/start/nvim-cmp/lua/cmp/source.lua:296: in function 'complete'
        ...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/core.lua:288: in function 'complete'
        ...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/core.lua:170: in function 'autoindent'
        ...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/core.lua:162: in function 'on_change'
        ...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/init.lua:301: in function 'callback'
        .../site/pack/packer/start/nvim-cmp/lua/cmp/utils/async.lua:122: in function <.../site/pack/packer/start/nvim-cmp/lua/cmp/utils/async.lua:120>