raise tailwind result priority in the autocomplete

This commit is contained in:
Fábio André Damas 2025-07-23 21:07:35 +01:00
parent 73a876aa81
commit 1a272de743
2 changed files with 30 additions and 7 deletions

View file

@ -15,6 +15,29 @@ return {
completion = {
documentation = { auto_show = true, auto_show_delay_ms = 500 },
},
fuzzy = {
sorts = {
function(a, b)
local function get_client_name(item)
return item.client_id and vim.lsp.get_client_by_id(item.client_id).name or ""
end
local ca = get_client_name(a)
local cb = get_client_name(b)
local a_is_tailwind = ca == "tailwindcss"
local b_is_tailwind = cb == "tailwindcss"
-- Tailwind always wins over everything else
if a_is_tailwind and not b_is_tailwind then return true end
if b_is_tailwind and not a_is_tailwind then return false end
-- Fall back to default order
end,
'score',
'sort_text',
},
},
},
opts_extend = { "sources.default" },
}