Replies: 2 comments 2 replies
-
Please see this. |
Beta Was this translation helpful? Give feedback.
2 replies
-
providers = {
lsp = {
---@type fun(ctx: blink.cmp.Context, items: blink.cmp.CompletionItem[])
transform_items = function(ctx, items)
---@diagnostic disable-next-line: redundant-return-value
return vim.tbl_filter(function(item)
local c = ctx.get_cursor()
local cursor_line = ctx.line
local cursor = {
row = c[1],
col = c[2] + 1,
line = c[1] - 1,
}
local cursor_before_line = string.sub(cursor_line, 1, cursor.col - 1)
-- remove text
if item.kind == vim.lsp.protocol.CompletionItemKind.Text then return false end
if vim.bo.filetype == "vue" then
-- For events
if cursor_before_line:match "(@[%w]*)%s*$" ~= nil then
return item.label:match "^@" ~= nil
-- For props also exclude events with `:on-` prefix
elseif cursor_before_line:match "(:[%w]*)%s*$" ~= nil then
return item.label:match "^:" ~= nil and not item.label:match "^:on%-" ~= nil
-- For slot
elseif cursor_before_line:match "(#[%w]*)%s*$" ~= nil then
return item.kind == vim.lsp.protocol.CompletionItemKind.Method
end
end
return true
end, items)
end,
},
}, |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
chaozwn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Feature Description
the logic in
nvim-cmp
, and how can i set up in blink.cmpBeta Was this translation helpful? Give feedback.
All reactions