r(indents): fix brace_list alignment

This commit is contained in:
Pedro Castro 2022-03-28 16:08:30 -03:00 committed by Christian Clason
parent 3b974b7257
commit cf9faaa0e3
3 changed files with 8 additions and 4 deletions

View file

@ -3,6 +3,7 @@
(paren_list) (paren_list)
(special) (special)
(pipe) (pipe)
(call)
"|>" "|>"
"if" "if"
"else" "else"
@ -16,10 +17,6 @@
")" ")"
] @branch ] @branch
((call) @aligned_indent
(#set! "delimiter" "()"))
((formal_parameters (identifier)) @aligned_indent ((formal_parameters (identifier)) @aligned_indent
(#set! "delimiter" "()")) (#set! "delimiter" "()"))

View file

@ -10,3 +10,9 @@ foo <- function(x) {
) )
) )
} }
baz <- function(l) {
inner(l, function(x) {
})
}

View file

@ -27,6 +27,7 @@ describe("indent R:", function()
run:new_line("func.R", { on_line = 2, text = "a <- a + 1", indent = 4 }) run:new_line("func.R", { on_line = 2, text = "a <- a + 1", indent = 4 })
run:new_line("func.R", { on_line = 6, text = "0,", indent = 6 }) run:new_line("func.R", { on_line = 6, text = "0,", indent = 6 })
run:new_line("func.R", { on_line = 6, text = "0,", indent = 6 }) run:new_line("func.R", { on_line = 6, text = "0,", indent = 6 })
run:new_line("func.R", { on_line = 16, text = "x <- x + 1", indent = 4 })
run:new_line("loop.R", { on_line = 1, text = "x <- x + 1", indent = 0 }) run:new_line("loop.R", { on_line = 1, text = "x <- x + 1", indent = 0 })
run:new_line("loop.R", { on_line = 3, text = "x <- x + 1", indent = 2 }) run:new_line("loop.R", { on_line = 3, text = "x <- x + 1", indent = 2 })