micangl / cmp-vimtex

Vimtex source for nvim-cmp.
MIT License
78 stars 5 forks source link

lspkind can not work with this #26

Closed Kaiser-Yang closed 1 month ago

Kaiser-Yang commented 1 month ago

I see this #7, it seems that lspkind not work properly (in this issue, it mentioned that the problem has been solved, but I met this too).

So I just comment the lspkind part, and after this, I can get the completion of the cmp-vimtex.

The commented code:

    formatting = {
        format = lspkind.cmp_format {
            mode = 'symbol',
            maxwidth = 50,
            ellipsis_char = '...',
            symbol_map = {
                Text = "󰉿",
                Method = "󰆧",
                Function = "󰊕",
                Constructor = "",
                Field = "󰜢",
                Variable = "󰀫",
                Class = "󰠱",
                Interface = "",
                Module = "",
                Property = "󰜢",
                Unit = "󰑭",
                Value = "󰎠",
                Enum = "",
                Keyword = "󰌋",
                Snippet = "",
                Color = "󰏘",
                File = "󰈙",
                Reference = "󰈇",
                Folder = "󰉋",
                EnumMember = "",
                Constant = "󰏿",
                Struct = "󰙅",
                Event = "",
                Operator = "󰆕",
                TypeParameter = "",
                Calc = "",
                Git = "",
                Search = "",
                Rime = "",
                Clipboard = "",
                Call = "",
                Copilot = "",
            },
            before = function(entry, vim_item)
                vim_item.menu = "["..string.upper(entry.source.name).."]"

                if entry.source.name == "calc" then
                    vim_item.kind = "Calc"
                end

                if entry.source.name == "git" then
                    vim_item.kind = "Git"
                end

                if entry.source.name == "rg" then
                    vim_item.kind = "Search"
                end

                if entry.source.name == "cmp_yanky" then
                    vim_item.kind = "Clipboard"
                end
                -- if entry.source.name == "copilot" then
                --     vim_item.kind = "Copilot"
                -- end

                -- if entry.source.name == "rime" then
                --     vim_item.kind = "Rime"
                -- end

                -- vim_item = require("tailwindcss-colorizer-cmp").formatter(entry, vim_item)
                return vim_item
            end,
        },
    },

I want to keep this part to use lspkind, what can I do to fix this?

Kaiser-Yang commented 1 month ago

I've fixed this by using this code:

                if entry.source.name ~= 'vimtex' then
                    vim_item.menu = "["..string.upper(entry.source.name).."]"
                end