diff --git a/lua/treewalker/nodes.lua b/lua/treewalker/nodes.lua index eea05c2..7652065 100644 --- a/lua/treewalker/nodes.lua +++ b/lua/treewalker/nodes.lua @@ -1,27 +1,16 @@ local util = require "treewalker.util" local lines= require "treewalker.lines" -local NON_TARGET_NODE_MATCHERS = { - -- "chunk", -- lua +local TARGET_TYPE_BLACKLIST = { "^.*comment.*$", } -local TARGET_DESCENDANT_TYPES = { - "body_statement", -- lua, rb - "block", -- lua - "statement_block", -- lua - - -- "then", -- helps rb, hurts lua - "do_block", -- rb -} - local M = {} ---@param node TSNode ---@return boolean function M.is_jump_target(node) - for _, matcher in ipairs(NON_TARGET_NODE_MATCHERS) do - -- If it's a banned type + for _, matcher in ipairs(TARGET_TYPE_BLACKLIST) do if node:type():match(matcher) then return false end @@ -29,10 +18,6 @@ function M.is_jump_target(node) return true end -function M.is_descendant_jump_target(node) - return util.contains(TARGET_DESCENDANT_TYPES, node:type()) -end - ---Do the nodes have the same starting point ---@param node1 TSNode ---@param node2 TSNode