mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-12 16:30:02 -04:00
Fixed incorrect Java indentation for method chaining
This commit is contained in:
parent
2472e47e15
commit
e1f8a8a6f8
3 changed files with 9 additions and 1 deletions
|
|
@ -11,6 +11,8 @@
|
||||||
(formal_parameters)
|
(formal_parameters)
|
||||||
] @indent
|
] @indent
|
||||||
|
|
||||||
|
(expression_statement (method_invocation) @indent)
|
||||||
|
|
||||||
[
|
[
|
||||||
"("
|
"("
|
||||||
")"
|
")"
|
||||||
|
|
@ -22,7 +24,6 @@
|
||||||
|
|
||||||
[
|
[
|
||||||
"}"
|
"}"
|
||||||
")"
|
|
||||||
] @indent_end
|
] @indent_end
|
||||||
|
|
||||||
(line_comment) @ignore
|
(line_comment) @ignore
|
||||||
|
|
|
||||||
6
tests/indent/java/method_chaining.java
Normal file
6
tests/indent/java/method_chaining.java
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
public class Foo {
|
||||||
|
void foo() {
|
||||||
|
new StringBuilder()
|
||||||
|
.append("a")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -30,5 +30,6 @@ describe("indent Java:", function()
|
||||||
XFAIL
|
XFAIL
|
||||||
)
|
)
|
||||||
run:new_line("issue_2583.java", { on_line = 4, text = "int x = 1;", indent = 4 })
|
run:new_line("issue_2583.java", { on_line = 4, text = "int x = 1;", indent = 4 })
|
||||||
|
run:new_line("method_chaining.java", { on_line = 4, text = ".append(\"b\");", indent = 6 })
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue