treewalker.nvim icon indicating copy to clipboard operation
treewalker.nvim copied to clipboard

Treewalker if clause improvement

Open I-Own-You opened this issue 3 months ago • 1 comments

another question in the meantime, isnt there a way to cycle between if / else if / else clauses with treesitter ? i know the if itself is 1 node with all the if else / else inside it, but still i am asking because going up 1 level with Treewalker Left actually exits exacly 1 level and puts the cursor on the needed clause
example:

  1. if i am inside if and i do Treewalker Left, it puts cursor on the start of the line where if is
  2. if i am inside else if then doing Treewalker Left puts the cursor on the start of the line of else if
  3. if i am inside else and doing Treewalker Left puts sthe cursor on the start of the line of else
    Will it be hard to implement Treewalker Up/Down for if construction ?

I-Own-You avatar Aug 22 '26 23:08 I-Own-You

Yeah it's AST node based. Up/down strictly goes to neighboring nodes. So if your parser for your language puts the else / else ifs as child nodes, then Treewalker won't be able to jump to them with up/down

aaronik avatar Aug 24 '26 17:08 aaronik