From cf9faaa0e3970e372c4ac2fe21912cb599e71863 Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Mon, 28 Mar 2022 16:08:30 -0300 Subject: r(indents): fix brace_list alignment --- queries/r/indents.scm | 5 +---- tests/indent/r/func.R | 6 ++++++ tests/indent/r_spec.lua | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/queries/r/indents.scm b/queries/r/indents.scm index e95d2338c..66e1e989b 100644 --- a/queries/r/indents.scm +++ b/queries/r/indents.scm @@ -3,6 +3,7 @@ (paren_list) (special) (pipe) + (call) "|>" "if" "else" @@ -16,10 +17,6 @@ ")" ] @branch - -((call) @aligned_indent - (#set! "delimiter" "()")) - ((formal_parameters (identifier)) @aligned_indent (#set! "delimiter" "()")) diff --git a/tests/indent/r/func.R b/tests/indent/r/func.R index bc184dfb7..2048dd87a 100644 --- a/tests/indent/r/func.R +++ b/tests/indent/r/func.R @@ -10,3 +10,9 @@ foo <- function(x) { ) ) } + +baz <- function(l) { + inner(l, function(x) { + + }) +} diff --git a/tests/indent/r_spec.lua b/tests/indent/r_spec.lua index 7b624411d..ac1ed31e3 100644 --- a/tests/indent/r_spec.lua +++ b/tests/indent/r_spec.lua @@ -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 = 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 = 3, text = "x <- x + 1", indent = 2 }) -- cgit v1.2.3-70-g09d2