uga-rosa/cmp-dictionary

source name was not shown

zanglg opened this issue · 2 comments

   96         sources = cmp.config.sources({
   97             { name = "nvim_lsp" },
   98             { name = "luasnip" },
   99             { name = "path" },
  100             { name = "buffer" },
  101             { name = "nvim_lsp_signature_help" },
  102             { name = "dictionary", keyword_length = 3 },
  103         }),
  104
  105         diagnost
  106        ┌──────────────────────────────────┐
  107diagnosticVariable [LSP] │
  108diagnosticsVariable [LSP] │em)
  109diagnosticsVariable [LSP] │at("%s %s", kind_icons[vim_item.kind], vim_item.kind)
  110diagnosticsVariable [LSP] │
  111diagnosticVariable [LSP] │
  112diagnosticsVariable [LSP] │
  113diagnosticlsVariable [LSP] │
  114diagnosticText115diagnosticsText116diagnosticateText117diagnosticianText118     }) │ diagnosticallyText119diagnosticationText120     -- └──────────────────────────────────┘s

the text was not shown with dictionary, how should I config for that purpose, here was my config:

  147     use({
  148         "uga-rosa/cmp-dictionary",
  149         config = function()
  150             require("cmp_dictionary").setup({
  151                 dic = {
  152                     ["*"] = { "/usr/share/dict/words" },
  153                 },
  154             })
  155         end,
  156     })

A part of my setup

cmp.setup({
    ...
    formatting = {
        format = function(entry, vim_item)
            vim_item.kind = lspkind[vim_item.kind] .. " " .. vim_item.kind
            vim_item.menu = ({
                buffer = "[Buffer]",
                path = "[Path]",
                nvim_lsp = "[LSP]",
                nvim_lua = "[NvimLua]",
                luasnip = "[LuaSnip]",
                dictionary = "[Dict]",
            })[entry.source.name]
            vim_item.dup = ({
                buffer = 0,
                nvim_lua = 0,
                dictionary = 0,
            })[entry.source.name] or 1
            return vim_item
        end,
    },
    ...
})

that works, thanks.