From c02781e3bf1c492cf7d0be794910a3d4cf0d6b4d Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Thu, 17 Jul 2025 13:33:17 +0200 Subject: [PATCH] fix(blink.cmp): suggestions priority - Put the snippets first - https://github.com/Saghen/blink.cmp/issues/1098#issuecomment-2679295335 --- lua/plugins-configure.lua | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lua/plugins-configure.lua b/lua/plugins-configure.lua index 27ccb86..6e22520 100644 --- a/lua/plugins-configure.lua +++ b/lua/plugins-configure.lua @@ -1,3 +1,10 @@ +local source_priority = { + snippets = 4, + lsp = 3, + path = 2, + buffer = 1 +} + require('lazy').setup({ -- NOTE: First, some plugins that don't require any configuration @@ -104,7 +111,21 @@ require('lazy').setup({ -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` -- -- See the fuzzy documentation for more information - fuzzy = { implementation = "prefer_rust_with_warning" } + fuzzy = { + implementation = "prefer_rust_with_warning", + sorts = { + function(a, b) + local a_priority = source_priority[a.source_id]; + local b_priority = source_priority[b.source_id]; + if a_priority ~= b_priority then + return a_priority > b_priority + end + end, + -- default + 'score', + 'sort_text' + } + } }, opts_extend = { "sources.default" } },