lspkind: integration with blink.cmp

This commit is contained in:
Ching Pei Yang 2025-01-11 21:32:30 +01:00
parent 9667610e7c
commit 8e1dbc7df2
No known key found for this signature in database
GPG key ID: B3841364253DC4C8

View file

@ -8,16 +8,18 @@
inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.lsp.lspkind; cfg = config.vim.lsp.lspkind;
usingCmp = config.vim.autocomplete.nvim-cmp.enable;
usingBlink = config.vim.autocomplete.blink-cmp.enable;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
assertions = [ assertions = [
{ {
assertion = config.vim.autocomplete.nvim-cmp.enable; assertion = usingCmp || usingBlink;
message = '' message = ''
While lspkind supports Neovim's native lsp upstream, using that over 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.
''; '';
} }
]; ];
@ -26,9 +28,19 @@ in {
startPlugins = ["lspkind"]; startPlugins = ["lspkind"];
lsp.lspkind.setupOpts.before = config.vim.autocomplete.nvim-cmp.format; lsp.lspkind.setupOpts.before = config.vim.autocomplete.nvim-cmp.format;
autocomplete.nvim-cmp.setupOpts.formatting.format = mkForce (mkLuaInline '' autocomplete = {
nvim-cmp = mkIf usingCmp {
setupOpts.formatting.format = mkForce (mkLuaInline ''
require("lspkind").cmp_format(${toLuaObject cfg.setupOpts}) require("lspkind").cmp_format(${toLuaObject cfg.setupOpts})
''); '');
}; };
blink-cmp = mkIf usingBlink {
setupOpts.appearance.kind_icons = mkLuaInline ''
require("lspkind").symbol_map
'';
};
};
};
}; };
} }