Skip to content

regex filter for lsp_references #1210

Answered by ibhagwan
serranomorante asked this question in Q&A
Discussion options

You must be logged in to vote

@serranomorante, see a9e5755

Added some improvements including the below:

:FzfLua lsp_references regex_filter={"import.*from.*",exclude=true}
-- equal to:
:lua require("fzf-lua").lsp_finder({ regex_filter = {"import.*from.*", exclude=true} })

You can also define regex_filter as a function, when it returns false the item will be filtered out:

-- Explore `ctx` and `item` with `vim.print` so you can decide on your filtering logic
-- `ctx` contains buffer number and so you can determine `filetype`, etc
:lua require("fzf-lua").lsp_finder({regex_filter=function(e,ctx) vim.print(ctx); return true end})

When a function is used the header will display <function> , can be disabled with header=false:

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@serranomorante
Comment options

Comment options

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

@ibhagwan
Comment options

Answer selected by serranomorante
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants