aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Woznicki <danwoz@nettoolkit.com>2022-02-24 19:21:09 -0800
committerStephan Seitz <stephan.seitz@fau.de>2022-02-25 08:03:43 +0100
commit18c558fd92b5ec800f976c447452ede4e96e9de9 (patch)
tree4501fedd0397c3c767227507836eeba50ff73abe
parentFixed a bug where Java enum body indentation was not correct (diff)
downloadnvim-treesitter-18c558fd92b5ec800f976c447452ede4e96e9de9.tar
nvim-treesitter-18c558fd92b5ec800f976c447452ede4e96e9de9.tar.gz
nvim-treesitter-18c558fd92b5ec800f976c447452ede4e96e9de9.tar.bz2
nvim-treesitter-18c558fd92b5ec800f976c447452ede4e96e9de9.tar.lz
nvim-treesitter-18c558fd92b5ec800f976c447452ede4e96e9de9.tar.xz
nvim-treesitter-18c558fd92b5ec800f976c447452ede4e96e9de9.tar.zst
nvim-treesitter-18c558fd92b5ec800f976c447452ede4e96e9de9.zip
Fixed a bug where indentation was not correct for class/enum bodies that had an annotation
-rw-r--r--queries/java/indents.scm2
-rw-r--r--tests/indent/java/class_with_annotation.java3
-rw-r--r--tests/indent/java/enum_with_annotation.java3
-rw-r--r--tests/indent/java_spec.lua2
4 files changed, 8 insertions, 2 deletions
diff --git a/queries/java/indents.scm b/queries/java/indents.scm
index 239311dbc..6300959c3 100644
--- a/queries/java/indents.scm
+++ b/queries/java/indents.scm
@@ -1,7 +1,5 @@
[
- (class_declaration)
(class_body)
- (enum_declaration)
(enum_body)
(constructor_declaration)
(constructor_body)
diff --git a/tests/indent/java/class_with_annotation.java b/tests/indent/java/class_with_annotation.java
new file mode 100644
index 000000000..19d62f97a
--- /dev/null
+++ b/tests/indent/java/class_with_annotation.java
@@ -0,0 +1,3 @@
+@Nothing
+public class Testo {
+}
diff --git a/tests/indent/java/enum_with_annotation.java b/tests/indent/java/enum_with_annotation.java
new file mode 100644
index 000000000..52edd7612
--- /dev/null
+++ b/tests/indent/java/enum_with_annotation.java
@@ -0,0 +1,3 @@
+@Nothing
+public enum Testo {
+}
diff --git a/tests/indent/java_spec.lua b/tests/indent/java_spec.lua
index c0025dc88..8506992fb 100644
--- a/tests/indent/java_spec.lua
+++ b/tests/indent/java_spec.lua
@@ -19,5 +19,7 @@ describe("indent Java:", function()
run:new_line("method.java", { on_line = 1, text = "void foo() {}", indent = 2 })
run:new_line("issue_2571.java", { on_line = 5, text = "void bar() {}", indent = 2 })
run:new_line("enum.java", { on_line = 2, text = "THING_B,", indent = 2 })
+ run:new_line("class_with_annotation.java", { on_line = 2, text = "void foo() {}", indent = 2 })
+ run:new_line("enum_with_annotation.java", { on_line = 2, text = "THING;", indent = 2 })
end)
end)