File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -81,12 +81,19 @@ local function make_snapshot(lnum)
8181 if is_empty and context .has_ts then
8282 local node = treesitter .get_node ({ pos = { lnum - 1 , 0 } })
8383 if node then
84- context .tree_node_type = node :tree ():root ():type () or context .tree_node_type
85- if node :type () == context .tree_node_type then
86- local packed = pack_snapshot (true , 0 , 0 )
87- context .snapshot [lnum ] = packed
88- return unpack_snapshot (packed )
84+ context .tree_root = context .tree_root or node :tree ():root ():type ()
85+ local indent = 0
86+ if context .tree_root and node :type () ~= context .tree_root then
87+ local parent = node :parent ()
88+ if parent then
89+ local p_srow = parent :range ()
90+ indent = get_indent_lnum (p_srow + 1 )
91+ indent = indent + context .step
92+ end
8993 end
94+ local packed = pack_snapshot (true , indent , indent )
95+ context .snapshot [lnum ] = packed
96+ return unpack_snapshot (packed )
9097 end
9198 end
9299
You can’t perform that action at this time.
0 commit comments