Skip to content

Commit 85978dc

Browse files
Kozororkibhagwan
authored andcommitted
Added ability to filter treesitter nodes
1 parent fc42c4c commit 85978dc

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lua/fzf-lua/providers/buffers.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,10 +592,10 @@ M.treesitter = function(opts)
592592
for _, definition in ipairs(get(bufnr0)) do
593593
local nodes = get_local_nodes(definition)
594594
for _, node in ipairs(nodes) do
595-
if node.node then
595+
node.kind = node.kind and node.kind:gsub(".*%.", "")
596+
if node.node and (not opts.node_filter or opts.node_filter(node, node.kind)) then
596597
vim.schedule(function()
597598
-- Remove node prefix, e.g. `locals.definition.var`
598-
node.kind = node.kind and node.kind:gsub(".*%.", "")
599599
local lnum, col, _, _ = ts.get_node_range(node.node)
600600
local node_text = ts.get_node_text(node.node, bufnr0)
601601
local node_kind = node.kind and utils.ansi_from_hl(kind2hl(node.kind), node.kind)

0 commit comments

Comments
 (0)