Skip to content

Commit

Permalink
lspkind: integration with blink.cmp
Browse files Browse the repository at this point in the history
  • Loading branch information
horriblename committed Jan 13, 2025
1 parent 9667610 commit 8e1dbc7
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions modules/plugins/lsp/lspkind/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@
inherit (lib.nvim.lua) toLuaObject;

cfg = config.vim.lsp.lspkind;
usingCmp = config.vim.autocomplete.nvim-cmp.enable;
usingBlink = config.vim.autocomplete.blink-cmp.enable;
in {
config = mkIf cfg.enable {
assertions = [
{
assertion = config.vim.autocomplete.nvim-cmp.enable;
assertion = usingCmp || usingBlink;
message = ''
While lspkind supports Neovim's native lsp upstream, using that over
nvim-cmp isn't recommended, nor supported by nvf.
nvim-cmp/blink.cmp isn't recommended, nor supported by nvf.
Please migrate to nvim-cmp if you want to use lspkind.
Please migrate to nvim-cmp/blink.cmp if you want to use lspkind.
'';
}
];
Expand All @@ -26,9 +28,19 @@ in {
startPlugins = ["lspkind"];

lsp.lspkind.setupOpts.before = config.vim.autocomplete.nvim-cmp.format;
autocomplete.nvim-cmp.setupOpts.formatting.format = mkForce (mkLuaInline ''
require("lspkind").cmp_format(${toLuaObject cfg.setupOpts})
'');
autocomplete = {
nvim-cmp = mkIf usingCmp {
setupOpts.formatting.format = mkForce (mkLuaInline ''
require("lspkind").cmp_format(${toLuaObject cfg.setupOpts})
'');
};

blink-cmp = mkIf usingBlink {
setupOpts.appearance.kind_icons = mkLuaInline ''
require("lspkind").symbol_map
'';
};
};
};
};
}

0 comments on commit 8e1dbc7

Please sign in to comment.