feat(indent): ecma - support common use-cases

This commit is contained in:
Munif Tanjim 2022-01-21 18:44:30 +06:00 committed by Christian Clason
parent 782e299cd6
commit 7a6d93ca5b
8 changed files with 149 additions and 20 deletions

View file

@ -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)