WIP - new approach to autoindent

- Indent one row at a time.
- Consider only the innermost match.
This commit is contained in:
Max Brunsfeld
2021-05-27 15:05:19 -07:00
parent fc8758c619
commit 79878f20cc
4 changed files with 80 additions and 87 deletions
+9 -1
View File
@@ -1,4 +1,12 @@
name = "Rust"
path_suffixes = ["rs"]
indent = 4
indent_nodes = ["declaration_list", "block"]
idents = [
{ inside = "let_declaration" },
{ inside = "field_declaration" },
{ start = "where_clause", end = ["block", "field_declaration_list"] },
{ after = "{", before = "}" },
{ start = "(", end = ")" },
{ start = "[", end = "]" },
]
+6 -5
View File
@@ -1,7 +1,8 @@
(where_clause) @indent
(field_expression) @inside
(let_declaration) @inside
(field_expression) @indent
((_ . "where" @after) _ @until)
(_ "(" ")" @outdent) @indent
(_ "[" "]" @outdent) @indent
(_ "{" "}" @outdent) @indent
(_ "{" @after "}" @until)
(_ "[" @after "]" @until)
(_ "(" @after ")" @until)