summaryrefslogtreecommitdiff
path: root/queries/ecma/indents.scm
diff options
context:
space:
mode:
authorMunif Tanjim <hello@muniftanjim.dev>2022-01-21 18:44:30 +0600
committerChristian Clason <christian.clason@uni-due.de>2022-01-21 16:40:36 +0100
commit7a6d93ca5b95b4485dd70c1a1d813bb5a80fcc07 (patch)
treea3ee6950f76938ccc8e85b9d78f9da92b097e1dd /queries/ecma/indents.scm
parent782e299cd6c926e0b5e438e154cac44a48c26a3c (diff)
feat(indent): ecma - support common use-cases
Diffstat (limited to 'queries/ecma/indents.scm')
-rw-r--r--queries/ecma/indents.scm40
1 files changed, 28 insertions, 12 deletions
diff --git a/queries/ecma/indents.scm b/queries/ecma/indents.scm
index 6b8f0ff0..6630562e 100644
--- a/queries/ecma/indents.scm
+++ b/queries/ecma/indents.scm
@@ -1,33 +1,49 @@
[
- (object)
- (array)
(arguments)
- (statement_block)
- (object_pattern)
+ (array)
+ (binary_expression)
(class_body)
+ (export_clause)
+ (formal_parameters)
(method_definition)
(named_imports)
- (binary_expression)
+ (object)
+ (object_pattern)
(return_statement)
- (template_substitution)
- (expression_statement (call_expression))
- (export_clause)
- (switch_statement)
+ (statement_block)
(switch_case)
+ (switch_statement)
+ (template_substitution)
+ (ternary_expression)
] @indent
+(arguments (call_expression) @indent)
+(binary_expression (call_expression) @indent)
+(expression_statement (call_expression) @indent)
+(arrow_function
+ body: (_) @_body
+ (#not-has-type? @_body statement_block)
+) @indent
+(assignment_expression
+ right: (_) @_right
+ (#not-has-type? @_right arrow_function function)
+) @indent
+(variable_declarator
+ value: (_) @_value
+ (#not-has-type? @_value arrow_function call_expression function)
+) @indent
+(arguments ")" @indent_end)
+(object "}" @indent_end)
(statement_block "}" @indent_end)
[
(arguments (object))
- "("
")"
- "{"
"}"
- "["
"]"
] @branch
+(statement_block "{" @branch)
[
(comment)