nvim-treesitter/queries/dart/indents.scm
Christian Clason cc908cfcd7 fix(dart): replace slow indent with simpler strategy
Pattern for dedenting else blocks is painfully slow (~20% of total test
time), so replace with `@indent.auto` for the whole `if_statement` for
now.
2024-01-25 13:12:53 +01:00

49 lines
781 B
Scheme

[
(class_body)
(function_body)
(function_expression_body)
(declaration
(initializers))
(switch_block)
(formal_parameter_list)
(formal_parameter)
(list_literal)
(return_statement)
(arguments)
(try_statement)
] @indent.begin
(switch_block
(_) @indent.begin
(#set! indent.immediate 1)
(#set! indent.start_at_same_line 1))
[
(switch_statement_case)
(switch_statement_default)
] @indent.branch
[
"("
")"
"{"
"}"
"["
"]"
] @indent.branch
"}" @indent.end
(return_statement
";" @indent.end)
(break_statement
";" @indent.end)
(comment) @indent.ignore
; dedenting the else block is painfully slow; replace with simpler strategy
; (if_statement) @indent.begin
; (if_statement
; (block) @indent.branch)
(if_statement) @indent.auto