uga-rosa / cmp-dictionary

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

wn: Executable not found #68

Closed jueshebe closed 3 months ago

jueshebe commented 3 months ago

Hi, I have been working with this Source successfully, but after an update with PlugUpdate, I have encountered the following error:

Full Log

Error executing vim.schedule lua callback: ...ocal/share/nvim/plugged/plenary.nvim/lua/plenary/job.lua:107: wn: Executable not found
stack traceback:
        ...ocal/share/nvim/plugged/plenary.nvim/lua/plenary/job.lua:107: in function 'new'
        .../nvim/plugged/cmp-dictionary/lua/cmp_dictionary/util.lua:19: in function 'system'
        ...vim/plugged/cmp-dictionary/lua/cmp_dictionary/source.lua:100: in function 'resolve'
        ...he/.local/share/nvim/plugged/nvim-cmp/lua/cmp/source.lua:384: in function 'resolve'
        ...ehe/.local/share/nvim/plugged/nvim-cmp/lua/cmp/entry.lua:495: in function 'resolve'
        ...tehe/.local/share/nvim/plugged/nvim-cmp/lua/cmp/view.lua:287: in function 'fn'
        ...ocal/share/nvim/plugged/nvim-cmp/lua/cmp/utils/async.lua:71: in function <...ocal/share/nvim/plugged/nvim-cmp/lua/cmp/utils/async.lua:69>
stack traceback:
        [C]: in function 'error'
        ...ocal/share/nvim/plugged/plenary.nvim/lua/plenary/job.lua:107: in function 'new'
        .../nvim/plugged/cmp-dictionary/lua/cmp_dictionary/util.lua:19: in function 'system'
        ...vim/plugged/cmp-dictionary/lua/cmp_dictionary/source.lua:100: in function 'resolve'
        ...he/.local/share/nvim/plugged/nvim-cmp/lua/cmp/source.lua:384: in function 'resolve'
        ...ehe/.local/share/nvim/plugged/nvim-cmp/lua/cmp/entry.lua:495: in function 'resolve'
        ...tehe/.local/share/nvim/plugged/nvim-cmp/lua/cmp/view.lua:287: in function 'fn'
        ...ocal/share/nvim/plugged/nvim-cmp/lua/cmp/utils/async.lua:71: in function <...ocal/share/nvim/plugged/nvim-cmp/lua/cmp/utils/async.lua:69>

I'm using Nvim v0.9.1 and this is how I call the source when setting cmp.

sources = cmp.config.sources({
        {
            name = "dictionary",
      }
}),
loca dict = require("cmp_dictionary")
local home = vim.fn.expand('$HOME')
local rel_english_language = "/.config/nvim/lua/plugins/completition/en.dict"
local english_language_path = home .. rel_english_language
dict.setup({
    paths = {english_language_path},
  first_case_insensitive = false,
  document = {
    enable = true,
    command = { "wn", "${label}", "-over" },
  },
})

I don't understand quite well the error, but it seems that I don't have the binary 'wn'. The error occurs only when I select a previous or next element from the suggestions.

Thanks for your time

alisanoelia commented 3 months ago

Hello, it worked for me:

command = { "dict", "${label}", "-over" },

uga-rosa commented 3 months ago

You have to install wordnet. That's why I didn't enable it by default.

                        *cmp-dictionary-option-document*
document ~
    table   (default: {
      enable = false,
      command = {},
    })

    |vim.system()| or plenary.nvim is required.
        https://github.com/nvim-lua/plenary.nvim

    If enabled, activate document using external command.

    The `${label}` in the command will be replaced by the item label.

    For example, to use wordnet to display a word description, set the
    following.
        https://wordnet.princeton.edu/
>lua
    {
      enable = true,
      command = { "wn", "${label}", "-over" },
    }
<