nvim-treesitter/queries/rust/indents.scm

95 lines
1.5 KiB
Scheme
Raw Normal View History

2021-01-05 19:26:08 +07:00
[
(mod_item)
(struct_item)
(enum_item)
(impl_item)
(for_expression)
(struct_expression)
(match_expression)
(tuple_expression)
2021-01-05 19:26:08 +07:00
(match_arm)
2021-02-23 09:58:32 -05:00
(match_block)
2021-01-05 19:26:08 +07:00
(call_expression)
(assignment_expression)
(arguments)
(block)
(where_clause)
(use_list)
2022-01-18 21:17:26 +06:00
(array_expression)
(ordered_field_declaration_list)
(field_declaration_list)
(enum_variant_list)
(parameters)
(token_tree)
(macro_definition)
] @indent.begin
2022-01-18 21:17:26 +06:00
; Typing in "(" inside macro definitions breaks the tree entirely
; Making macro_definition becoming errors
; Offset this by adding back one indent for start of macro rules
(ERROR
.
"macro_rules!"
"(" @indent.begin
(#set! indent.immediate)
(#set! indent.start_at_same_line))
2024-01-06 15:05:50 +09:00
(trait_item
body: (_) @indent.begin)
(string_literal
(escape_sequence)) @indent.begin
(block
"}" @indent.end)
(enum_item
2024-01-06 15:05:50 +09:00
body:
(enum_variant_list
"}" @indent.end))
(impl_item
2024-01-06 15:05:50 +09:00
body:
(declaration_list
"}" @indent.end))
(match_expression
2024-01-06 15:05:50 +09:00
body:
(match_block
"}" @indent.end))
(mod_item
2024-01-06 15:05:50 +09:00
body:
(declaration_list
"}" @indent.end))
(struct_item
2024-01-06 15:05:50 +09:00
body:
(field_declaration_list
"}" @indent.end))
(trait_item
2024-01-06 15:05:50 +09:00
body:
(declaration_list
"}" @indent.end))
2024-01-06 15:05:50 +09:00
(impl_item
(where_clause) @indent.dedent)
2021-01-05 19:26:08 +07:00
[
"where"
")"
"]"
"}"
] @indent.branch
2024-01-06 15:05:50 +09:00
(impl_item
(declaration_list) @indent.branch)
[
(line_comment)
2022-01-18 21:17:26 +06:00
(string_literal)
] @indent.ignore
2022-01-18 21:17:26 +06:00
(raw_string_literal) @indent.auto