Skip to content

How to filter entry item in LSP with specify filetype? #667

Answered by chaozwn
chaozwn asked this question in Q&A
Discussion options

You must be logged in to vote
        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

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@chaozwn
Comment options

@Shougo
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by chaozwn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
feature New feature or request
2 participants
Converted from issue

This discussion was converted from issue #666 on December 20, 2024 06:46.