Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some times vim_item.kind is nil #1939

Open
2 tasks done
Kicamon opened this issue May 21, 2024 · 0 comments
Open
2 tasks done

Some times vim_item.kind is nil #1939

Kicamon opened this issue May 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Kicamon
Copy link

Kicamon commented May 21, 2024

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Announcement

Minimal reproducible full config

return {
  'hrsh7th/nvim-cmp',
  lazy = true,
  event = 'LspAttach',
  dependencies = {
    'hrsh7th/cmp-nvim-lsp',
    {
      'saadparwaiz1/cmp_luasnip',
      dependencies = {
        'L3MON4D3/LuaSnip',
      },
    },
    'hrsh7th/cmp-buffer',
    'hrsh7th/cmp-path',
  },
  config = function()
    local cmp_kinds = {
      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 = " 󰅲 ",
    }
    local cmp = require('cmp')
    cmp.setup({
      formatting = {
        fields = { 'kind', 'abbr', 'menu' },
        format = function(_, vim_item)
          vim_item.menu = ' ' .. vim_item.kind
          vim_item.kind = cmp_kinds[vim_item.kind]
          return vim_item
        end,
      },
     }),
  end,
}

The following is normal
normal

and this is wrong
bug

Description

some times the vim_item.kind is nil

Steps to reproduce

It appears irregularly

Expected behavior

pop-ups steadily

Actual behavior

as you see

Additional context

No response

@Kicamon Kicamon added the bug Something isn't working label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant