nvim-treesitter/nvim-treesitter-textobjects

`swap` can not swap children across parents

ofseed opened this issue · 0 comments

To record a regression I found while refactoring main.

function f1(arg1, arg2)
  ...
end

function f2(arg3, arg4)
  ...
end

Formerly if we call swap_next("@parameter.inner") while the cursor is at arg2, nothing will happen, because there's no next parameter in the same parent node. Now it will swap with arg3 in f2 because it is the next parameter even though they do not have a common parent node.

Currently, it seems not possible to do this because we only record nodes' range, but it should be easily fixed if we complete #674.