Skip to content

Commit

Permalink
feat: improve indents
Browse files Browse the repository at this point in the history
I have been tweaking these indent queries during work on projects and
this seems like a good version to contribute, there are a few/bunch of
small issues you encounter with the current indentation queries.
  • Loading branch information
laytan committed Apr 3, 2024
1 parent f94c590 commit 729bffc
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions queries/indents.scm
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
[
(block)
(procedure_declaration)
(overloaded_procedure_declaration)
(enum_declaration)
(union_declaration)
(when_statement)
(for_statement)
(struct_declaration)
(struct)
(parameters)
(tuple_type)
(call_expression)
(switch_case)
] @indent.begin

; hello(
((identifier) . (ERROR "(" @indent.begin))

[
"}"
")"
"]"
] @indent.branch @indent.end

; Have to do all closing brackets separately because the one for switch statements shouldn't end.
(block "}" @indent.branch @indent.end)
(enum_declaration "}" @indent.branch @indent.end)
(union_declaration "}" @indent.branch @indent.end)
(struct_declaration "}" @indent.branch @indent.end)
(struct "}" @indent.branch @indent.end)

[
(comment)
(block_comment)
Expand Down

0 comments on commit 729bffc

Please sign in to comment.