onsails / lspkind.nvim

vscode-like pictograms for neovim lsp completion items
MIT License
1.47k stars 36 forks source link

Ignores width? #81

Open 9mm opened 2 months ago

9mm commented 2 months ago

Hey, whats up with the width? anything i put for maxsize, whether its 1, 100, or the function all look like this:

image

if i uncomment your plugin and use plain old cmp it looks like this:

image
      formatting = {
        expandable_indicator = true,
        fields = {
          "abbr",
          "kind",
          -- "menu",
        },
        format = lspkind.cmp_format({
          mode = "symbol_text",
          maxwidth = 10,
          ellipsis_char = "...",
          show_labelDetails = false,
          before = function (entry, item)
            return item
          end,
        })
  }
9mm commented 2 months ago

Very weird... the only way i got it to work was to set a blank string... i have no idea why

      formatting = {
        expandable_indicator = true,
        fields = {
          "abbr",
          "kind",
          "menu",
        },
        format = lspkind.cmp_format({
          mode = "symbol_text",
          maxwidth = 65,
          -- ellipsis_char = "...",
          show_labelDetails = false,
          before = function (entry, item)
            item.menu = ""
            return item
          end,
        })
tzachar commented 1 month ago

I think #83 fixes this.

eeeXun commented 1 month ago

What is your version of neovim and nvim-cmp? I'm on the neovim 0.10.1 and latest nvim-cmp. This is the default nvim-cmp looks like.

image

The blank spaces in your picture should be the message provided by nvim_lsp. The workaround for this could be to provide menus for each source.

        format = lspkind.cmp_format({
            menu = {
                path = "[PATH]",
                buffer = "[BUF]",
                nvim_lsp = "[LSP]",
                nvim_lua = "[LUA]",
                luasnip = "[SNIP]",
            },
        }),

Or just disable the menu of nvim_lsp.

        format = lspkind.cmp_format({
            menu = { nvim_lsp = nil },
        }),