Cool stuff

This commit is contained in:
2025-12-09 23:07:24 +00:00
parent 5bf1ec232e
commit e89dbcac87
2 changed files with 153 additions and 79 deletions

View File

@@ -60,7 +60,7 @@ end, { desc = 'Select surrounding treesitter node' })
local swappable_nodes = { 'argument', 'array_element_initializer', 'simple_parameter', 'string', 'integer', 'member_call_expression', 'method_declaration' }
local function closest_swappable_node(node)
while node and not vim.list_contains(swappable_nodes, node:type()) do
while node and not vim.list_contains(swappable_nodes, node:type()) and (not node:next_named_sibling() or not node:prev_named_sibling()) do
node = node:parent()
end
return node