raise tailwind result priority in the autocomplete
This commit is contained in:
parent
73a876aa81
commit
1a272de743
2 changed files with 30 additions and 7 deletions
|
|
@ -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" },
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue