From 3f699fde8fba0089f80957220f782feef52a7651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Fri, 20 Dec 2024 03:15:00 +0100 Subject: [PATCH] Update Blink config --- flake.lock | 4 ++-- home/nvim/files/lua/plugins/blink.lua | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/flake.lock b/flake.lock index f5370a3..0129187 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ "locked": { "lastModified": 1, "narHash": "sha256-DuhR3y0gPZG0AJ2FDd+nUKzQMwT+c/DFIUWNDQ5Uyx4=", - "path": "/nix/store/kiva355rzlqaqhs56h8klkcggdg0wivf-source/home/ags", + "path": "/nix/store/v7xsk4kvdnnpj7zvr4bl47wxycbx4qy6-source/home/ags", "type": "path" }, "original": { - "path": "/nix/store/kiva355rzlqaqhs56h8klkcggdg0wivf-source/home/ags", + "path": "/nix/store/v7xsk4kvdnnpj7zvr4bl47wxycbx4qy6-source/home/ags", "type": "path" } }, diff --git a/home/nvim/files/lua/plugins/blink.lua b/home/nvim/files/lua/plugins/blink.lua index b76915d..01040e5 100644 --- a/home/nvim/files/lua/plugins/blink.lua +++ b/home/nvim/files/lua/plugins/blink.lua @@ -33,6 +33,27 @@ return { }, sources = { default = { 'lsp', 'path', 'snippets', 'buffer' }, + transform_items = function(_, items) + for _, item in ipairs(items) do + local types = require('blink.cmp.types') + local map = {} + map[types.CompletionItemKind.Text] = -3 + map[types.CompletionItemKind.Method] = 10 + map[types.CompletionItemKind.Function] = 9 + map[types.CompletionItemKind.Field] = 8 + map[types.CompletionItemKind.Class] = 7 + map[types.CompletionItemKind.Variable] = 6 + map[types.CompletionItemKind.Property] = 5 + + if map[item.kind] ~= nil then + item.score_offset = item.score_offset + map[item.kind] + end + if item.label:match("^__") then + item.score_offset = item.score_offset - 3 + end + end + return items + end, providers = { lsp = { async = true,