aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--queries/r/indents.scm4
-rw-r--r--tests/indent/r_spec.lua9
2 files changed, 6 insertions, 7 deletions
diff --git a/queries/r/indents.scm b/queries/r/indents.scm
index 86acddc5f..600214eaf 100644
--- a/queries/r/indents.scm
+++ b/queries/r/indents.scm
@@ -12,7 +12,8 @@
] @indent.begin
(binary_operator
- operator: (_)) @indent.begin
+ rhs: (_) @_no_indent
+ (#not-kind-eq? @_no_indent function_definition)) @indent.begin
[
"}"
@@ -20,6 +21,7 @@
] @indent.branch
((parameters
+ .
(parameter
name: (identifier))) @indent.align
(#set! indent.open_delimiter "(")
diff --git a/tests/indent/r_spec.lua b/tests/indent/r_spec.lua
index dc3fe9b8c..60271b6a7 100644
--- a/tests/indent/r_spec.lua
+++ b/tests/indent/r_spec.lua
@@ -10,9 +10,7 @@ local run = Runner:new(it, "tests/indent/r", {
describe("indent R:", function()
describe("whole file:", function()
- run:whole_file(".", {
- expected_failures = { "./pipe.R" },
- })
+ run:whole_file(".", {})
end)
describe("new line:", function()
@@ -34,9 +32,8 @@ describe("indent R:", function()
run:new_line("loop.R", { on_line = 8, text = "x <- x + 1", indent = 2 })
run:new_line("loop.R", { on_line = 14, text = "print('lol')", indent = 4 })
- -- FIXME: |>, %>% indent broken after parser update
- -- run:new_line("pipe.R", { on_line = 1, text = "head(n = 10L) |>", indent = 2 })
- -- run:new_line("pipe.R", { on_line = 9, text = "head()", indent = 2 })
+ run:new_line("pipe.R", { on_line = 1, text = "head(n = 10L) |>", indent = 2 })
+ run:new_line("pipe.R", { on_line = 9, text = "head()", indent = 2 })
run:new_line("aligned_indent.R", { on_line = 1, text = "z,", indent = 17 })
end)