aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMunif Tanjim <hello@muniftanjim.dev>2022-02-26 19:59:48 +0600
committerStephan Seitz <stephan.seitz@fau.de>2022-02-26 15:44:11 +0100
commit20168d8e20ec8335fddba0f519f63f53db760d72 (patch)
tree47d78338c5c8ca4d5a53ae83834e30b8dea14563
parentUpdate lockfile.json (diff)
downloadnvim-treesitter-20168d8e20ec8335fddba0f519f63f53db760d72.tar
nvim-treesitter-20168d8e20ec8335fddba0f519f63f53db760d72.tar.gz
nvim-treesitter-20168d8e20ec8335fddba0f519f63f53db760d72.tar.bz2
nvim-treesitter-20168d8e20ec8335fddba0f519f63f53db760d72.tar.lz
nvim-treesitter-20168d8e20ec8335fddba0f519f63f53db760d72.tar.xz
nvim-treesitter-20168d8e20ec8335fddba0f519f63f53db760d72.tar.zst
nvim-treesitter-20168d8e20ec8335fddba0f519f63f53db760d72.zip
fix(indent): ecma - class method indentation
-rw-r--r--queries/ecma/indents.scm1
-rw-r--r--tests/indent/ecma/class.js20
-rw-r--r--tests/indent/javascript_spec.lua14
3 files changed, 34 insertions, 1 deletions
diff --git a/queries/ecma/indents.scm b/queries/ecma/indents.scm
index 6630562ea..3b8260fbf 100644
--- a/queries/ecma/indents.scm
+++ b/queries/ecma/indents.scm
@@ -5,7 +5,6 @@
(class_body)
(export_clause)
(formal_parameters)
- (method_definition)
(named_imports)
(object)
(object_pattern)
diff --git a/tests/indent/ecma/class.js b/tests/indent/ecma/class.js
new file mode 100644
index 000000000..e22cdef36
--- /dev/null
+++ b/tests/indent/ecma/class.js
@@ -0,0 +1,20 @@
+class IndentTest {
+ async isEqual(paramOne, paramTwo) {
+ if (paramOne === paramTwo) {
+ return true
+ }
+
+ return false
+ }
+
+ async isNotEqual(
+ paramOne,
+ paramTwo,
+ ) {
+ if (paramOne !== paramTwo) {
+ return true
+ }
+
+ return false
+ }
+}
diff --git a/tests/indent/javascript_spec.lua b/tests/indent/javascript_spec.lua
index 98c46d8ff..6af93c190 100644
--- a/tests/indent/javascript_spec.lua
+++ b/tests/indent/javascript_spec.lua
@@ -38,6 +38,20 @@ describe("indent JavaScript:", function()
for _, info in
ipairs {
+ { 1, 2 },
+ { 2, 4 },
+ { 3, 6 },
+ { 5, 4 },
+ { 8, 2 },
+ { 11, 4 },
+ { 13, 4 },
+ }
+ do
+ run:new_line("ecma/class.js", { on_line = info[1], text = "//", indent = info[2] }, info[3], info[4])
+ end
+
+ for _, info in
+ ipairs {
{ 2, 2 },
{ 5, 2 },
{ 7, 0 },