mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-10 23:40:04 -04:00
feat(indent): ecma - support common use-cases
This commit is contained in:
parent
782e299cd6
commit
7a6d93ca5b
8 changed files with 149 additions and 20 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue