Skip to content

Commit

Permalink
Add filter for top node selection
Browse files Browse the repository at this point in the history
  • Loading branch information
duqcyxwd committed Dec 16, 2024
1 parent a577028 commit 18b0d92
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions lua/treewalker/nodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local lines= require "treewalker.lines"
local NON_TARGET_NODE_MATCHERS = {
-- "chunk", -- lua
"^.*comment.*$",
"block"
}

local TARGET_DESCENDANT_TYPES = {
Expand Down
2 changes: 1 addition & 1 deletion lua/treewalker/strategies.lua
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function M.get_current_top_node()
local parent_start_row, parent_start_col = parent:range()

-- If the node does not start at the same position as its parent, return the node
if start_row ~= parent_start_row or start_col ~= parent_start_col then
if start_row ~= parent_start_row or start_col ~= parent_start_col or not nodes.is_jump_target(parent) then
return node
end

Expand Down

0 comments on commit 18b0d92

Please sign in to comment.