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

ray-x/cmp-treesitter/pull/10 cause completion system to broke #624

Closed
Tracked by #627
CharlesChiuGit opened this issue Apr 7, 2023 · 6 comments · Fixed by TonyWu20/nvimdots#11
Closed
Tracked by #627
Labels
bug Something isn't working cmp Nvim-cmp related issues has:workaround This issue is not fixed but can be circumvented until then upstream Upstream (neovim/plugin) issues

Comments

@CharlesChiuGit
Copy link
Collaborator

ray-x/cmp-treesitter#10 introduces dynamic kind_text, causing lspkind's symbol_text unable to replace kind_text with icons.

@ayamir
Copy link
Owner

ayamir commented Apr 7, 2023

Yes, I have encountered this problem.

@CharlesChiuGit
Copy link
Collaborator Author

@ayamir We might need to lock the commit for now.

@CharlesChiuGit CharlesChiuGit changed the title ray-x/cmp-treesitter/pull/10 cause our completion system broke ray-x/cmp-treesitter/pull/10 cause our completion system to broke Apr 7, 2023
@3rd
Copy link

3rd commented Apr 7, 2023

Hey, replied in ray-x/cmp-treesitter#10, it should be a quick and sane change for lspkind to provide a default icon.

@CharlesChiuGit CharlesChiuGit changed the title ray-x/cmp-treesitter/pull/10 cause our completion system to broke ray-x/cmp-treesitter/pull/10 cause completion system to broke Apr 7, 2023
@3rd
Copy link

3rd commented Apr 7, 2023

@CharlesChiuGit btw nice work on the nvim distro, to keep it lean you could remove lspkind.nvim as a dependency, it only maps an icon to a kind and adds a clipping feature, don't think you'd need much more than this:

local kind_icons = {
  Class = "",
  -- Class = "",
  -- Class = "",
  Color = "",
  -- Color = "",
  Constant = "",
  -- Constant = "",
  Constructor = "",
  -- Constructor = "",
  -- Constructor = "",
  Enum = "",
  EnumMember = "",
  Event = "",
  Field = "",
  -- Field = "",
  -- Field = "",
  -- Field = "",
  File = "",
  -- File = "",
  -- File = "",
  Folder = "",
  -- Folder = "",
  Function = "",
  Interface = "",
  Keyword = "",
  Method = "",
  Module = "",
  Operator = "",
  Property = "",
  -- Property = "ﰠ",
  Reference = "",
  -- Reference = "",
  -- Reference = "",
  Snippet = "",
  -- Snippet = "",
  Struct = "",
  -- Struct = "",
  Text = "",
  -- Text = "",
  TypeParameter = "",
  -- TypeParameter = "",
  Unit = "",
  Value = "",
  Variable = "",
  -- Variable = "",
  -- Variable = "",
  -- tree-sitter
  String = "",
}

cmp.setup({
  formatting = {
    format = function(entry, vim_item)
      local icon = kind_icons[vim_item.kind] or "default icon or text"
      vim_item.kind = icon .. " " .. vim_item.kind
      return vim_item
    end,
  }
})

, and you're always in control & it's easy to extend.

@CharlesChiuGit
Copy link
Collaborator Author

@CharlesChiuGit btw nice work on the nvim distro, to keep it lean you could remove lspkind.nvim as a dependency, it only maps an icon to a kind and adds a clipping feature, don't think you'd need much more than this:

local kind_icons = {
  Class = "",
  -- Class = "",
  -- Class = "",
  Color = "",
  -- Color = "",
  Constant = "",
  -- Constant = "",
  Constructor = "",
  -- Constructor = "",
  -- Constructor = "",
  Enum = "",
  EnumMember = "",
  Event = "",
  Field = "",
  -- Field = "",
  -- Field = "",
  -- Field = "",
  File = "",
  -- File = "",
  -- File = "",
  Folder = "",
  -- Folder = "",
  Function = "",
  Interface = "",
  Keyword = "",
  Method = "",
  Module = "",
  Operator = "",
  Property = "",
  -- Property = "ﰠ",
  Reference = "",
  -- Reference = "",
  -- Reference = "",
  Snippet = "",
  -- Snippet = "",
  Struct = "",
  -- Struct = "",
  Text = "",
  -- Text = "",
  TypeParameter = "",
  -- TypeParameter = "",
  Unit = "",
  Value = "",
  Variable = "",
  -- Variable = "",
  -- Variable = "",
  -- tree-sitter
  String = "",
}

cmp.setup({
  formatting = {
    format = function(entry, vim_item)
      local icon = kind_icons[vim_item.kind] or "   "
      vim_item.kind = icon .. " " .. vim_item.kind
      return vim_item
    end,
  }
})

, and you're always in control & it's easy to extend.

That's a nice idea! Thanks for the advice, I'll look into that.

@Jint-lzxy Jint-lzxy added bug Something isn't working has:workaround This issue is not fixed but can be circumvented until then cmp Nvim-cmp related issues upstream Upstream (neovim/plugin) issues labels Apr 7, 2023
@CharlesChiuGit
Copy link
Collaborator Author

Jint-lzxy added a commit that referenced this issue Apr 30, 2023
* chore(README): bump supported version

* feat(options): support new options shipped with v0.9

* feat(scripts): support v0.9

* feat!: add initial support for lsp semantic tokens (#633)

* feat(utils): use neovim builtin to get highlights (#632)

* fix: remove deprecated options for nvim-tree.

* fix(cmp): support dynamic `kind_text` from cmp source: `treesitter`, fix #624 #634 (#637)

* fix&feat: introduce suda.vim to write file with sudo

* chore(kind_text): cleanup (#648)

* feat(alpha): add custom highlight groups (#650)

* fix: install `psutils` by default for Windows users

* revert: bind `SudaWrite` to `<A-s>`

ref: #641 (comment)

* fix(cmp): nil `vim_item`

* perf(core-mapping): add some useful mapping

* fix(nvim-tree): `hide_root_folder` is deprecated

* perf: load fidget.nvim after `LspAttach`

* minor fix

1. remove `<nop>` at "n|Q"
2. use visual mode instead of visual-line mode for "n|<C-a>"

* perf: align style

* perf(0.9): `stabilize.nvim` had been upstream to `0.9`

* chore(project.nvim): update legacy code

* chore(README): update branch info

* chore(mapping): cleanup (#657)

* fix(icon): update invalid cmp icon (#665)

* chore/lspsaga_move (#667)

* fix: paint word boundary in python (#669)

* fix(bufferline): `show_buffer_default_icon` is now deprecate

* feat(formatting): notify users for files under disabled dirs

* chore(formatting): rephrase messages

* fix(font-encoding): fix invalid characters on windows, fix #639 (#659)

Co-authored-by: 冷酔閑吟 <50296129+Jint-lzxy@users.noreply.github.com>

* pref: unify code style for PowerShell commands

* perf: better guidance to `Discussions` and `Wiki` (#680)

* pref(ISSUE_TEMPLATE): fix typos and format with prettier

* fixup! pref(ISSUE_TEMPLATE): fix typos and format with prettier

* feat(scripts): abort for nvim v0.7 and its antecedent

* feat(settings): allow customization of `transparent_background` (#687)

* fix(bufferline): use defaults for `get_element_icon` (#685)

* feat(auto-session): remember opened buffers (#688)

* revert(keymap): remove redundant mappings.

* fix(catppuccin): properly detect `g:colors_name` (#695)

Ref: upstream breaking change [catppuccin/nvim@7a7a664]

---------

Co-authored-by: ayamir <lgt986452565@gmail.com>
Co-authored-by: Charles Chiu <charleschiu@hey.com>
Co-authored-by: CharlesChiuGit <charleschiu2012@gmail.com>
Co-authored-by: Xie Zejian <xiezej@gmail.com>
Co-authored-by: AngelontheRoad <52699138+AngelontheRoad@users.noreply.github.com>
Co-authored-by: Saafo <46736350+Saafo@users.noreply.github.com>
singlemancombat pushed a commit to singlemancombat/nvim-config that referenced this issue May 1, 2023
* chore(README): bump supported version

* feat(options): support new options shipped with v0.9

* feat(scripts): support v0.9

* feat!: add initial support for lsp semantic tokens (ayamir#633)

* feat(utils): use neovim builtin to get highlights (ayamir#632)

* fix: remove deprecated options for nvim-tree.

* fix(cmp): support dynamic `kind_text` from cmp source: `treesitter`, fix ayamir#624 ayamir#634 (ayamir#637)

* fix&feat: introduce suda.vim to write file with sudo

* chore(kind_text): cleanup (ayamir#648)

* feat(alpha): add custom highlight groups (ayamir#650)

* fix: install `psutils` by default for Windows users

* revert: bind `SudaWrite` to `<A-s>`

ref: ayamir#641 (comment)

* fix(cmp): nil `vim_item`

* perf(core-mapping): add some useful mapping

* fix(nvim-tree): `hide_root_folder` is deprecated

* perf: load fidget.nvim after `LspAttach`

* minor fix

1. remove `<nop>` at "n|Q"
2. use visual mode instead of visual-line mode for "n|<C-a>"

* perf: align style

* perf(0.9): `stabilize.nvim` had been upstream to `0.9`

* chore(project.nvim): update legacy code

* chore(README): update branch info

* chore(mapping): cleanup (ayamir#657)

* fix(icon): update invalid cmp icon (ayamir#665)

* chore/lspsaga_move (ayamir#667)

* fix: paint word boundary in python (ayamir#669)

* fix(bufferline): `show_buffer_default_icon` is now deprecate

* feat(formatting): notify users for files under disabled dirs

* chore(formatting): rephrase messages

* fix(font-encoding): fix invalid characters on windows, fix ayamir#639 (ayamir#659)

Co-authored-by: 冷酔閑吟 <50296129+Jint-lzxy@users.noreply.github.com>

* pref: unify code style for PowerShell commands

* perf: better guidance to `Discussions` and `Wiki` (ayamir#680)

* pref(ISSUE_TEMPLATE): fix typos and format with prettier

* fixup! pref(ISSUE_TEMPLATE): fix typos and format with prettier

* feat(scripts): abort for nvim v0.7 and its antecedent

* feat(settings): allow customization of `transparent_background` (ayamir#687)

* fix(bufferline): use defaults for `get_element_icon` (ayamir#685)

* feat(auto-session): remember opened buffers (ayamir#688)

* revert(keymap): remove redundant mappings.

* fix(catppuccin): properly detect `g:colors_name` (ayamir#695)

Ref: upstream breaking change [catppuccin/nvim@7a7a664]

---------

Co-authored-by: ayamir <lgt986452565@gmail.com>
Co-authored-by: Charles Chiu <charleschiu@hey.com>
Co-authored-by: CharlesChiuGit <charleschiu2012@gmail.com>
Co-authored-by: Xie Zejian <xiezej@gmail.com>
Co-authored-by: AngelontheRoad <52699138+AngelontheRoad@users.noreply.github.com>
Co-authored-by: Saafo <46736350+Saafo@users.noreply.github.com>
boomker pushed a commit to boomker/uvcode-nvim that referenced this issue May 2, 2023
* chore(README): bump supported version

* feat(options): support new options shipped with v0.9

* feat(scripts): support v0.9

* feat!: add initial support for lsp semantic tokens (ayamir#633)

* feat(utils): use neovim builtin to get highlights (ayamir#632)

* fix: remove deprecated options for nvim-tree.

* fix(cmp): support dynamic `kind_text` from cmp source: `treesitter`, fix ayamir#624 ayamir#634 (ayamir#637)

* fix&feat: introduce suda.vim to write file with sudo

* chore(kind_text): cleanup (ayamir#648)

* feat(alpha): add custom highlight groups (ayamir#650)

* fix: install `psutils` by default for Windows users

* revert: bind `SudaWrite` to `<A-s>`

ref: ayamir#641 (comment)

* fix(cmp): nil `vim_item`

* perf(core-mapping): add some useful mapping

* fix(nvim-tree): `hide_root_folder` is deprecated

* perf: load fidget.nvim after `LspAttach`

* minor fix

1. remove `<nop>` at "n|Q"
2. use visual mode instead of visual-line mode for "n|<C-a>"

* perf: align style

* perf(0.9): `stabilize.nvim` had been upstream to `0.9`

* chore(project.nvim): update legacy code

* chore(README): update branch info

* chore(mapping): cleanup (ayamir#657)

* fix(icon): update invalid cmp icon (ayamir#665)

* chore/lspsaga_move (ayamir#667)

* fix: paint word boundary in python (ayamir#669)

* fix(bufferline): `show_buffer_default_icon` is now deprecate

* feat(formatting): notify users for files under disabled dirs

* chore(formatting): rephrase messages

* fix(font-encoding): fix invalid characters on windows, fix ayamir#639 (ayamir#659)

Co-authored-by: 冷酔閑吟 <50296129+Jint-lzxy@users.noreply.github.com>

* pref: unify code style for PowerShell commands

* perf: better guidance to `Discussions` and `Wiki` (ayamir#680)

* pref(ISSUE_TEMPLATE): fix typos and format with prettier

* fixup! pref(ISSUE_TEMPLATE): fix typos and format with prettier

* feat(scripts): abort for nvim v0.7 and its antecedent

* feat(settings): allow customization of `transparent_background` (ayamir#687)

* fix(bufferline): use defaults for `get_element_icon` (ayamir#685)

* feat(auto-session): remember opened buffers (ayamir#688)

* revert(keymap): remove redundant mappings.

* fix(catppuccin): properly detect `g:colors_name` (ayamir#695)

Ref: upstream breaking change [catppuccin/nvim@7a7a664]

---------

Co-authored-by: ayamir <lgt986452565@gmail.com>
Co-authored-by: Charles Chiu <charleschiu@hey.com>
Co-authored-by: CharlesChiuGit <charleschiu2012@gmail.com>
Co-authored-by: Xie Zejian <xiezej@gmail.com>
Co-authored-by: AngelontheRoad <52699138+AngelontheRoad@users.noreply.github.com>
Co-authored-by: Saafo <46736350+Saafo@users.noreply.github.com>
(cherry picked from commit 08c4561)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cmp Nvim-cmp related issues has:workaround This issue is not fixed but can be circumvented until then upstream Upstream (neovim/plugin) issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants