uga-rosa / cmp-dictionary

A dictionary completion source for nvim-cmp
MIT License
236 stars 16 forks source link

V3: multiple dictionaries #64

Closed eronde closed 5 months ago

eronde commented 5 months ago

In v2 it was possible to assign multiple dictionary with the switch option, like:

-- dict.switcher({
--   filetype = {
--     -- javascript = { "/path/to/js.dict", "/path/to/js2.dict" },
--   },
-- })

In v3 switcher is deprecated. If I try to add multiple dictionaries, like

local dict = {
  ["*"] = { "/home/eric/Dotfiles/vim/dict/nl.txt", "/home/eric/Dotfiles/vim/dict/training_english_GB.txt" },
}

This produces the following error:

Error executing luv callback:
...er/start/cmp-dictionary/lua/cmp_dictionary/dict/trie.lua:43: bad argument #1 to 'decode' (string expected, got nil)
stack traceback:
    [C]: in function 'decode'
    ...er/start/cmp-dictionary/lua/cmp_dictionary/dict/trie.lua:43: in function <...er/start/cmp-dictionary/lua/cmp_dictionary/dict/trie.lua:42>
Error in luv thread:
...er/start/cmp-dictionary/lua/cmp_dictionary/dict/trie.lua:40: Cannot serialise, excessive nesting (1001)

A workaround could be to concatenate the dicts into one dict

uga-rosa commented 5 months ago

Please read the documentation (:h cmp-dictionary-setting).