mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-21 12:50:09 -04:00
Clojure indent #_ properly, search parents for indent.end
This commit is contained in:
parent
fba13d610e
commit
5f284e4b74
2 changed files with 7 additions and 1 deletions
|
|
@ -177,7 +177,10 @@ function M.get_indent(lnum)
|
||||||
node = get_last_node_at_line(root, prevlnum, col)
|
node = get_last_node_at_line(root, prevlnum, col)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if q["indent.end"][node:id()] then
|
-- Recursively search upwards for any @indent.end nodes
|
||||||
|
local tmp = node
|
||||||
|
while tmp and not q["indent.end"][tmp:id()] do tmp = tmp:parent() end
|
||||||
|
if tmp then
|
||||||
node = get_first_node_at_line(root, lnum)
|
node = get_first_node_at_line(root, lnum)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -21,3 +21,6 @@
|
||||||
(anon_fn_lit . (sym_lit))]
|
(anon_fn_lit . (sym_lit))]
|
||||||
@indent.align
|
@indent.align
|
||||||
(#set! indent.increment 2))
|
(#set! indent.increment 2))
|
||||||
|
|
||||||
|
; Indent form on line following #_
|
||||||
|
((dis_expr) @indent.begin @indent.end)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue