mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 03:10:04 -04:00
fix(leo): indent } now properly dedents
This commit is contained in:
parent
f0f48e0290
commit
1087b183a7
1 changed files with 35 additions and 21 deletions
|
|
@ -1,33 +1,47 @@
|
||||||
[
|
[
|
||||||
(record_declaration)
|
|
||||||
(struct_declaration)
|
|
||||||
(mapping_declaration)
|
|
||||||
(constant_declaration)
|
|
||||||
(return_statement)
|
|
||||||
(expression_statement)
|
|
||||||
(variable_declaration)
|
|
||||||
(loop_statement)
|
|
||||||
(assignment_statement)
|
|
||||||
(assert_statement)
|
|
||||||
(struct_expression)
|
|
||||||
(array_expression)
|
(array_expression)
|
||||||
(tuple_expression)
|
(assert_statement)
|
||||||
(parenthesized_expression)
|
(assignment_statement)
|
||||||
(items_block)
|
|
||||||
(block)
|
(block)
|
||||||
|
(constant_declaration)
|
||||||
|
(expression_statement)
|
||||||
|
(items_block)
|
||||||
|
(loop_statement)
|
||||||
|
(mapping_declaration)
|
||||||
|
(parenthesized_expression)
|
||||||
|
(record_declaration)
|
||||||
|
(return_statement)
|
||||||
|
(struct_declaration)
|
||||||
|
(struct_expression)
|
||||||
|
(tuple_expression)
|
||||||
|
(variable_declaration)
|
||||||
] @indent.begin
|
] @indent.begin
|
||||||
|
|
||||||
; if "if" statement and conditional statement are in separate lines
|
|
||||||
; conditional should be indented and when the conditional block
|
|
||||||
; starts dedented
|
|
||||||
(branch
|
|
||||||
(block
|
|
||||||
"{" @indent.end)) @indent.begin
|
|
||||||
|
|
||||||
((function_parameters) @indent.align
|
((function_parameters) @indent.align
|
||||||
(#set! indent.open_delimiter "(")
|
(#set! indent.open_delimiter "(")
|
||||||
(#set! indent.close_delimiter ")"))
|
(#set! indent.close_delimiter ")"))
|
||||||
|
|
||||||
|
(record_declaration
|
||||||
|
"}" @indent.branch)
|
||||||
|
|
||||||
|
(struct_declaration
|
||||||
|
"}" @indent.branch)
|
||||||
|
|
||||||
|
(struct_expression
|
||||||
|
"}" @indent.branch)
|
||||||
|
|
||||||
|
(array_expression
|
||||||
|
"}" @indent.branch)
|
||||||
|
|
||||||
|
(tuple_expression
|
||||||
|
"}" @indent.branch)
|
||||||
|
|
||||||
|
(items_block
|
||||||
|
"}" @indent.branch)
|
||||||
|
|
||||||
|
(block
|
||||||
|
"}" @indent.branch)
|
||||||
|
|
||||||
[
|
[
|
||||||
(comment)
|
(comment)
|
||||||
(ERROR)
|
(ERROR)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue