ecosse3 / nvim

A non-minimal Neovim config built to work most efficiently with Frontend Development
GNU General Public License v3.0
1.19k stars 109 forks source link

Add lspkind symbol_map icons as they were getting overwritten #148

Closed doctorfree closed 1 year ago

doctorfree commented 1 year ago

In lua/plugins/cmp.lua the following was overwriting the lspkind symbol_map:

      -- Get the item with kind from the lspkind plugin
      local item_with_kind = require("lspkind").cmp_format({
        mode = "symbol_text",
        maxwidth = 50,
        symbol_map = source_mapping,
      })(entry, vim_item)

This PR adds symbol_map icons for lspkind. Completions now show icons for all types as well as source.

Thank you for doing this ingenious completion plugin(s) configuration. I borrowed heavily from it for my own config.

doctorfree commented 1 year ago

It may be more appropriate to add the symbol_map icons in the lspkind config. I haven't tried that and as far as I can tell they are only used by nvim-cmp. It's a minor modification, the current configuration looks and works well. So closing this PR or implementing the same thing differently is an ok move.

ecosse3 commented 1 year ago

What is the difference from the current symbol_map for types? Currently there are icons for types, but they are different from the one provided by you:

(Current type icons) image

Does it add any missing type icons? I've checked it and didn't notice anything additional that changed icons.

doctorfree commented 1 year ago

I've been on vacation, just back. It looks like you have the icons defined in lua/utils/icons.lua so these could be used rather than the ones provided in this PR. However, for some types (e.g. Text) it appears the default lspkind icon is used. The PR attempts to add icon definitions for types for which the default icon is used. Some of these may be unnecessary, that is, I may have been overly zealous.

The current set of default icons defined in lspkind is as follows:

    default = {
    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 = "",
  },

Identifying which types are still using the default icon from lspkind and adding that to the source_mapping defined in lua/plugins/cmp.lua could improve the look. This PR is overkill as you point out, some of the types are adequately defined. I think we should close this PR, it's not what you want to do. Rather, identify any types whose icon definition should be replaced with that defined in lua/utils/icons.lua and add it to source_mapping (e.g. Text = EcoVim.icons.text).

I do not have a list of the types still using the default icon.