mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-07 05:50:04 -04:00
use indent.X syntax for captures and properties of set directives
update CONTRIBUTING.md adjust indents for bass fix doc capture comment
This commit is contained in:
parent
b4fcc61175
commit
cb568af539
80 changed files with 592 additions and 575 deletions
|
|
@ -2,21 +2,21 @@
|
|||
(list)
|
||||
(scope)
|
||||
(cons)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
")"
|
||||
"}"
|
||||
"]"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
[
|
||||
(entry)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
[
|
||||
(array)
|
||||
(object)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
"}" @indent_end
|
||||
"}" @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
(diagnostic_comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -7,66 +7,66 @@
|
|||
(initializer_list)
|
||||
(init_declarator)
|
||||
(expression_statement)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(
|
||||
ERROR
|
||||
"for" "(" @indent ";" ";" ")" @indent_end)
|
||||
"for" "(" @indent.begin ";" ";" ")" @indent.end)
|
||||
(
|
||||
(for_statement
|
||||
body: (_) @_body
|
||||
) @indent
|
||||
) @indent.begin
|
||||
(#not-has-type? @_body compound_statement)
|
||||
)
|
||||
|
||||
(
|
||||
while_statement
|
||||
condition: (_) @indent
|
||||
condition: (_) @indent.begin
|
||||
)
|
||||
(
|
||||
(while_statement
|
||||
body: (_) @_body
|
||||
) @indent
|
||||
) @indent.begin
|
||||
(#not-has-type? @_body compound_statement)
|
||||
)
|
||||
|
||||
(
|
||||
(if_statement)
|
||||
(ERROR "else") @indent
|
||||
(ERROR "else") @indent.begin
|
||||
)
|
||||
|
||||
(
|
||||
if_statement
|
||||
condition: (_) @indent
|
||||
condition: (_) @indent.begin
|
||||
)
|
||||
;; Make sure all cases of if-else are tagged with @indent
|
||||
;; Make sure all cases of if-else are tagged with @indent.begin
|
||||
;; So we will offset the indents for the else case
|
||||
(
|
||||
(if_statement
|
||||
consequence: (compound_statement)
|
||||
"else" @branch
|
||||
"else" @indent.branch
|
||||
alternative:
|
||||
[
|
||||
[ "{" "}" ] @branch
|
||||
(compound_statement ["{" "}"] @branch)
|
||||
[ "{" "}" ] @indent.branch
|
||||
(compound_statement ["{" "}"] @indent.branch)
|
||||
(_)
|
||||
]
|
||||
) @indent
|
||||
) @indent.begin
|
||||
)
|
||||
(
|
||||
(if_statement
|
||||
consequence: (_ ";" @indent_end) @_consequence
|
||||
) @indent
|
||||
consequence: (_ ";" @indent.end) @_consequence
|
||||
) @indent.begin
|
||||
(#not-has-type? @_consequence compound_statement)
|
||||
)
|
||||
(
|
||||
(if_statement
|
||||
consequence: (_) @_consequence
|
||||
"else" @branch
|
||||
"else" @indent.branch
|
||||
alternative:
|
||||
[
|
||||
[ "{" "}" ] @branch
|
||||
(compound_statement ["{" "}"] @branch)
|
||||
[ "{" "}" ] @indent.branch
|
||||
(compound_statement ["{" "}"] @indent.branch)
|
||||
(_)
|
||||
]
|
||||
)
|
||||
|
|
@ -83,19 +83,19 @@
|
|||
consequence: (_)
|
||||
alternative:
|
||||
[
|
||||
(if_statement consequence: (compound_statement) @dedent)
|
||||
(if_statement consequence: (compound_statement) @indent.dedent)
|
||||
(_)
|
||||
] @dedent
|
||||
] @indent.dedent
|
||||
)
|
||||
)
|
||||
|
||||
(compound_statement "}" @indent_end)
|
||||
(compound_statement "}" @indent.end)
|
||||
|
||||
[
|
||||
")"
|
||||
"}"
|
||||
(statement_identifier)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
"#define"
|
||||
|
|
@ -105,18 +105,19 @@
|
|||
"#if"
|
||||
"#else"
|
||||
"#endif"
|
||||
] @zero_indent
|
||||
] @indent.zero
|
||||
|
||||
[
|
||||
(preproc_arg)
|
||||
(string_literal)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
||||
((ERROR (parameter_declaration)) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
([(argument_list) (parameter_list)] @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((ERROR (parameter_declaration)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
([(argument_list) (parameter_list)] @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
(comment) @indent.auto
|
||||
|
||||
(comment) @auto
|
||||
|
|
|
|||
|
|
@ -11,26 +11,26 @@
|
|||
(struct)
|
||||
(struct_shorthand)
|
||||
(union)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
((struct_shorthand (property)) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((struct_shorthand (property)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
((const_list (const_value)) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((const_list (const_value)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
[
|
||||
"}"
|
||||
")"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
(intent_def)
|
||||
(slot_def)
|
||||
(alias_def)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(ERROR "]") @indent
|
||||
(ERROR "]") @indent.begin
|
||||
|
|
|
|||
|
|
@ -3,21 +3,21 @@
|
|||
(map)
|
||||
(imap)
|
||||
(array)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"]"
|
||||
"}"
|
||||
">"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[ "<" ">" ] @branch
|
||||
[ "<" ">" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@
|
|||
[
|
||||
(class_specifier)
|
||||
(condition_clause)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
((field_initializer_list) @indent.begin
|
||||
(#set! indent.start_at_same_line 1))
|
||||
(access_specifier) @indent.branch
|
||||
|
||||
((field_initializer_list) @indent
|
||||
(#set! "start_at_same_line" 1))
|
||||
(access_specifier) @branch
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
[
|
||||
(block)
|
||||
(declaration)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(block ("}") @branch)
|
||||
("}") @dedent
|
||||
(block ("}") @indent.branch)
|
||||
("}") @indent.dedent
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
[
|
||||
(import_spec_list)
|
||||
(field)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"}"
|
||||
"]"
|
||||
")"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@
|
|||
(block_statement)
|
||||
(case_statement)
|
||||
(token_string)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"(" ")"
|
||||
"{" "}"
|
||||
"[" "]"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
(nesting_block_comment)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
(list_literal)
|
||||
(return_statement)
|
||||
(arguments)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"("
|
||||
|
|
@ -19,13 +19,13 @@
|
|||
"}"
|
||||
"["
|
||||
"]"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
"}"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
; this one is for dedenting the else block
|
||||
(if_statement (block) @branch)
|
||||
(if_statement (block) @indent.branch)
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
(node)
|
||||
(property)
|
||||
(integer_cells)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"}"
|
||||
">"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(comment)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
|
|
|||
|
|
@ -16,42 +16,42 @@
|
|||
(switch_statement)
|
||||
(template_substitution)
|
||||
(ternary_expression)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(arguments (call_expression) @indent)
|
||||
(binary_expression (call_expression) @indent)
|
||||
(expression_statement (call_expression) @indent)
|
||||
(arguments (call_expression) @indent.begin)
|
||||
(binary_expression (call_expression) @indent.begin)
|
||||
(expression_statement (call_expression) @indent.begin)
|
||||
(arrow_function
|
||||
body: (_) @_body
|
||||
(#not-has-type? @_body statement_block)
|
||||
) @indent
|
||||
) @indent.begin
|
||||
(assignment_expression
|
||||
right: (_) @_right
|
||||
(#not-has-type? @_right arrow_function function)
|
||||
) @indent
|
||||
) @indent.begin
|
||||
(variable_declarator
|
||||
value: (_) @_value
|
||||
(#not-has-type? @_value arrow_function call_expression function)
|
||||
) @indent
|
||||
) @indent.begin
|
||||
|
||||
(arguments ")" @indent_end)
|
||||
(object "}" @indent_end)
|
||||
(statement_block "}" @indent_end)
|
||||
(arguments ")" @indent.end)
|
||||
(object "}" @indent.end)
|
||||
(statement_block "}" @indent.end)
|
||||
|
||||
[
|
||||
(arguments (object))
|
||||
")"
|
||||
"}"
|
||||
"]"
|
||||
] @branch
|
||||
(statement_block "{" @branch)
|
||||
] @indent.branch
|
||||
(statement_block "{" @indent.branch)
|
||||
|
||||
(parenthesized_expression ("(" (_) ")" @indent_end))
|
||||
["}" "]"] @indent_end
|
||||
(parenthesized_expression ("(" (_) ")" @indent.end))
|
||||
["}" "]"] @indent.end
|
||||
|
||||
[
|
||||
(comment)
|
||||
(template_string)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
||||
(ERROR) @auto
|
||||
(ERROR) @indent.auto
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
(stab_clause)
|
||||
(tuple)
|
||||
(arguments)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
")"
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
"rescue"
|
||||
"}"
|
||||
"end"
|
||||
] @indent_end @branch
|
||||
] @indent.end @indent.branch
|
||||
|
||||
; Elixir pipelines are not indented, but other binary operator chains are
|
||||
((binary_operator operator: _ @_operator) @indent (#not-eq? @_operator "|>"))
|
||||
((binary_operator operator: _ @_operator) @indent.begin (#not-eq? @_operator "|>"))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
(reduction) @indent
|
||||
(reduction) @indent.begin
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
(if_statement)
|
||||
(begin_statement)
|
||||
(switch_statement)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
(else_if_clause)
|
||||
(else_clause)
|
||||
"end"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
[
|
||||
"{"
|
||||
"}"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[(dict) (key_value)] @indent
|
||||
[(dict) (key_value)] @indent.begin
|
||||
|
||||
|
||||
[
|
||||
(comment)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
(where_statement)
|
||||
(derived_type_definition)
|
||||
(enum)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
(end_module_statement)
|
||||
|
|
@ -24,4 +24,4 @@
|
|||
(end_type_statement)
|
||||
(end_enum_statement)
|
||||
(end_where_statement)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
|
|
|||
|
|
@ -5,15 +5,15 @@
|
|||
(afx_element_self_closing)
|
||||
(eel_array)
|
||||
(eel_object)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
|
||||
(block end: _ @branch)
|
||||
(value_dsl end: _ @branch)
|
||||
(eel_array end: _ @branch)
|
||||
(eel_object end: _ @branch)
|
||||
(block end: _ @indent.branch)
|
||||
(value_dsl end: _ @indent.branch)
|
||||
(eel_array end: _ @indent.branch)
|
||||
(eel_object end: _ @indent.branch)
|
||||
[
|
||||
(afx_closing_element)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@
|
|||
(match_body)
|
||||
(set_body)
|
||||
(get_body)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
(elif_clause)
|
||||
(else_clause)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(string)
|
||||
|
|
@ -26,46 +26,46 @@
|
|||
(dictionary)
|
||||
(parenthesized_expression)
|
||||
(ERROR)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
||||
[
|
||||
(pass_statement)
|
||||
(continue_statement)
|
||||
(break_statement)
|
||||
(return_statement)
|
||||
] @dedent
|
||||
] @indent.dedent
|
||||
|
||||
[
|
||||
(ERROR "[")
|
||||
(ERROR "(")
|
||||
(ERROR "{")
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
;; This only works with expanded tabs.
|
||||
; ((parameters) @aligned_indent (#set! "open_delimiter" "(") (#set! "close_delimiter" ")"))
|
||||
; ((arguments) @aligned_indent (#set! "open_delimiter" "(") (#set! "close_delimiter" ")"))
|
||||
; ((parameters) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")"))
|
||||
; ((arguments) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")"))
|
||||
|
||||
;; The following queries either do not agree with the current body parsing or are
|
||||
;; attempted workarounds. Specifically as the last statement of a body. Opening
|
||||
;; a new line in between statements works well.
|
||||
;;
|
||||
;; The overall experience is poor, so I've opted for @auto.
|
||||
;; The overall experience is poor, so I've opted for @indent.auto.
|
||||
;;
|
||||
;; The gdscript parser will need to be patched to accommodate more interactive
|
||||
;; edits. As far as I can tell the parser greedily consumes whitespace
|
||||
;; as a zero-width token which causes trouble when inserting indents.
|
||||
|
||||
;; This indents correctly with tabs.
|
||||
; (arguments) @indent
|
||||
; (parameters) @indent
|
||||
; (array) @indent
|
||||
; (dictionary) @indent
|
||||
; (parenthesized_expression) @indent
|
||||
; (arguments) @indent.begin
|
||||
; (parameters) @indent.begin
|
||||
; (array) @indent.begin
|
||||
; (dictionary) @indent.begin
|
||||
; (parenthesized_expression) @indent.begin
|
||||
|
||||
;; Partial workaround for when the cursor is on the bracket character and a newline
|
||||
;; is created with <o>. Without this the newline is opened with extra
|
||||
;; indentation.
|
||||
; (body (_ (array "]" @indent_end) ) _)
|
||||
; (body (_ (array "]" @indent.end) ) _)
|
||||
;; Problematic behaviors occur at the last statement of a body.
|
||||
;; with @dedent:
|
||||
;; - [ | ] i<CR> will dedent ] to 0.
|
||||
|
|
@ -75,4 +75,4 @@
|
|||
;; - [ | ] i<CR> same
|
||||
;; - [
|
||||
;; ]| o will open new line with extra indent.
|
||||
;(body (_ (array "]" @auto) ) .)
|
||||
;(body (_ (array "]" @indent.auto) ) .)
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
(todo)
|
||||
(try)
|
||||
(tuple)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
")"
|
||||
"]"
|
||||
"}"
|
||||
] @indent_end @branch
|
||||
] @indent.end @indent.branch
|
||||
|
||||
; Gleam pipelines are not indented, but other binary expression chains are
|
||||
((binary_expression operator: _ @_operator) @indent (#not-eq? @_operator "|>"))
|
||||
((binary_expression operator: _ @_operator) @indent.begin (#not-eq? @_operator "|>"))
|
||||
|
|
|
|||
|
|
@ -13,21 +13,21 @@
|
|||
(call_expression)
|
||||
(parameter_list)
|
||||
(struct_type)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"}"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(const_declaration ")" @branch)
|
||||
(import_spec_list ")" @branch)
|
||||
(var_declaration ")" @branch)
|
||||
(const_declaration ")" @indent.branch)
|
||||
(import_spec_list ")" @indent.branch)
|
||||
(var_declaration ")" @indent.branch)
|
||||
|
||||
[
|
||||
"}"
|
||||
")"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
(parameter_list ")" @branch)
|
||||
(parameter_list ")" @indent.branch)
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
[
|
||||
(definition)
|
||||
(selection)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
|
|
|||
|
|
@ -12,25 +12,25 @@
|
|||
(array_literal)
|
||||
(struct_literal)
|
||||
(tuple_literal)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(if_statement
|
||||
("(" condition: (_) ")") @indent)
|
||||
("(" condition: (_) ")") @indent.begin)
|
||||
|
||||
[
|
||||
"}"
|
||||
"]"
|
||||
")"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
(concatenated_string)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
(object)
|
||||
(tuple)
|
||||
(function_call)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"]"
|
||||
")"
|
||||
"}"
|
||||
] @branch @indent_end
|
||||
] @indent.branch @indent.end
|
||||
|
||||
(comment) @auto
|
||||
(ERROR) @auto
|
||||
(comment) @indent.auto
|
||||
(ERROR) @indent.auto
|
||||
|
|
|
|||
|
|
@ -3,18 +3,18 @@
|
|||
(component)
|
||||
(slot)
|
||||
(tag)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
; Dedent at the end of each tag, component, and slot
|
||||
[
|
||||
(end_component)
|
||||
(end_slot)
|
||||
(end_tag)
|
||||
] @branch @dedent
|
||||
] @indent.branch @indent.dedent
|
||||
|
||||
; Self-closing tags and components should not change
|
||||
; indentation level of sibling nodes
|
||||
[
|
||||
(self_closing_component)
|
||||
(self_closing_tag)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
; inherits: json
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
(#not-any-of? @_not_special "meta" "link")
|
||||
)
|
||||
(element (self_closing_tag))
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
; These tags are usually written one-lined and doesn't use self-closing tags so special-cased them
|
||||
; but add indent to the tag to make sure attributes inside them are still indented if written multi-lined
|
||||
|
|
@ -15,20 +15,20 @@
|
|||
(start_tag
|
||||
(tag_name) @_special)
|
||||
(#any-of? @_special "meta" "link")
|
||||
) @indent
|
||||
) @indent.begin
|
||||
|
||||
|
||||
; These are the nodes that will be captured when we do `normal o`
|
||||
; But last element has already been ended, so capturing this
|
||||
; to mark end of last element
|
||||
(element (end_tag [">"] @indent_end))
|
||||
(element (self_closing_tag "/>" @indent_end))
|
||||
(element (end_tag [">"] @indent.end))
|
||||
(element (self_closing_tag "/>" @indent.end))
|
||||
|
||||
; Script/style elements aren't indented, so only branch the end tag of other elements
|
||||
(element (end_tag) @branch)
|
||||
(element (end_tag) @indent.branch)
|
||||
[
|
||||
">"
|
||||
"/>"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
(paired_statement) @indent
|
||||
(end_paired_statement) @indent_end
|
||||
(branch_statement) @branch
|
||||
(paired_statement) @indent.begin
|
||||
(end_paired_statement) @indent.end
|
||||
(branch_statement) @indent.branch
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
(array_initializer)
|
||||
(argument_list)
|
||||
(formal_parameters)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(expression_statement (method_invocation) @indent)
|
||||
(expression_statement (method_invocation) @indent.begin)
|
||||
|
||||
[
|
||||
"("
|
||||
|
|
@ -19,13 +19,14 @@
|
|||
"}"
|
||||
"["
|
||||
"]"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
"}" @indent_end
|
||||
"}" @indent.end
|
||||
|
||||
(line_comment) @ignore
|
||||
(line_comment) @indent.ignore
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(block_comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
[
|
||||
(object)
|
||||
(array)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"}"
|
||||
"]"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
; inherits: json
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -3,19 +3,19 @@
|
|||
(jsx_element)
|
||||
(jsx_self_closing_element)
|
||||
(jsx_expression)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(jsx_fragment
|
||||
("<" ">" (_) "<" @branch "/" ">" @indent_end)
|
||||
("<" ">" (_) "<" @indent.branch "/" ">" @indent.end)
|
||||
)
|
||||
|
||||
(jsx_closing_element (">" @indent_end))
|
||||
(jsx_self_closing_element ">" @indent_end)
|
||||
(jsx_closing_element (">" @indent.end))
|
||||
(jsx_self_closing_element ">" @indent.end)
|
||||
|
||||
[
|
||||
(jsx_closing_element)
|
||||
">"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
; <button
|
||||
; />
|
||||
(jsx_self_closing_element "/" @branch)
|
||||
(jsx_self_closing_element "/" @indent.branch)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
(comprehension_expression)
|
||||
(matrix_expression)
|
||||
(vector_expression)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"end"
|
||||
|
|
@ -34,10 +34,10 @@
|
|||
(elseif_clause)
|
||||
(catch_clause)
|
||||
(finally_clause)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
(node (node_children) @indent)
|
||||
(node (node_children) @indent.begin)
|
||||
|
||||
"}" @indent_end
|
||||
"}" @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
[
|
||||
(journal_item)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
|
|
|||
|
|
@ -13,17 +13,17 @@
|
|||
(table_constructor)
|
||||
(arguments)
|
||||
(return_statement)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"end"
|
||||
")"
|
||||
"}"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
(return_statement
|
||||
(expression_list
|
||||
(function_call))) @dedent
|
||||
(function_call))) @indent.dedent
|
||||
|
||||
[
|
||||
"end"
|
||||
|
|
@ -35,8 +35,9 @@
|
|||
(elseif_statement)
|
||||
"else"
|
||||
(else_statement)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(comment) @auto
|
||||
(comment) @indent.auto
|
||||
|
||||
(string) @indent.auto
|
||||
|
||||
(string) @auto
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
(pool)
|
||||
(rule)
|
||||
(build)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@
|
|||
(recInitializer)
|
||||
(arrInitializer)
|
||||
(defaultValue)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(defProc (block) @indent)
|
||||
(defProc (block) @indent.begin)
|
||||
|
||||
[
|
||||
(kEnd)
|
||||
|
|
@ -29,4 +29,4 @@
|
|||
(declSection)
|
||||
"]"
|
||||
")"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
|
|
|||
|
|
@ -11,18 +11,18 @@
|
|||
(match_block)
|
||||
(case_statement)
|
||||
"["
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
")"
|
||||
"}"
|
||||
"]"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
||||
(compound_statement "}" @indent_end)
|
||||
(compound_statement "}" @indent.end)
|
||||
|
||||
(ERROR) @auto
|
||||
(ERROR) @indent.auto
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
(block) @indent
|
||||
(block) @indent.begin
|
||||
|
||||
(ERROR) @auto
|
||||
(ERROR) @indent.auto
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -14,97 +14,91 @@
|
|||
(lambda)
|
||||
|
||||
(concatenated_string)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
((list) @aligned_indent
|
||||
(#set! "open_delimiter" "[")
|
||||
(#set! "close_delimiter" "]")
|
||||
(#set! "dedent_lone_close_delimiter" 1)
|
||||
((list) @indent.align
|
||||
(#set! indent.open_delimiter "[")
|
||||
(#set! indent.close_delimiter "]")
|
||||
)
|
||||
((dictionary) @aligned_indent
|
||||
(#set! "open_delimiter" "{")
|
||||
(#set! "close_delimiter" "}")
|
||||
(#set! "dedent_lone_close_delimiter" 1)
|
||||
((dictionary) @indent.align
|
||||
(#set! indent.open_delimiter "{")
|
||||
(#set! indent.close_delimiter "}")
|
||||
)
|
||||
((set) @aligned_indent
|
||||
(#set! "open_delimiter" "{")
|
||||
(#set! "close_delimiter" "}")
|
||||
(#set! "dedent_lone_close_delimiter" 1)
|
||||
((set) @indent.align
|
||||
(#set! indent.open_delimiter "{")
|
||||
(#set! indent.close_delimiter "}")
|
||||
)
|
||||
|
||||
((for_statement) @indent
|
||||
(#set! "immediate_indent" 1))
|
||||
((if_statement) @indent
|
||||
(#set! "immediate_indent" 1))
|
||||
((while_statement) @indent
|
||||
(#set! "immediate_indent" 1))
|
||||
((try_statement) @indent
|
||||
(#set! "immediate_indent" 1))
|
||||
(ERROR "try" ":" @indent (#set! "immediate_indent" 1))
|
||||
((function_definition) @indent
|
||||
(#set! "immediate_indent" 1))
|
||||
((class_definition) @indent
|
||||
(#set! "immediate_indent" 1))
|
||||
((with_statement) @indent
|
||||
(#set! "immediate_indent" 1))
|
||||
((for_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
((if_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
((while_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
((try_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
(ERROR "try" ":" @indent.begin (#set! indent.immediate 1))
|
||||
((function_definition) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
((class_definition) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
((with_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
(if_statement
|
||||
condition: (parenthesized_expression) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")")
|
||||
(#set! "avoid_last_matching_next" 1)
|
||||
condition: (parenthesized_expression) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
(#set! indent.avoid_last_matching_next 1)
|
||||
)
|
||||
(while_statement
|
||||
condition: (parenthesized_expression) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")")
|
||||
(#set! "avoid_last_matching_next" 1)
|
||||
condition: (parenthesized_expression) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
(#set! indent.avoid_last_matching_next 1)
|
||||
)
|
||||
|
||||
(ERROR "(" @aligned_indent (#set! "open_delimiter" "(") (#set! "close_delimiter" ")") . (_))
|
||||
((argument_list) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((parameters) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")")
|
||||
(#set! "avoid_last_matching_next" 1))
|
||||
((tuple) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
(ERROR "(" @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")") . (_))
|
||||
((argument_list) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
((parameters) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
(#set! indent.avoid_last_matching_next 1))
|
||||
((tuple) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
(ERROR "[" @aligned_indent (#set! "open_delimiter" "[") (#set! "close_delimiter" "]") . (_))
|
||||
(list "]" @indent_end)
|
||||
(ERROR "[" @indent.align (#set! indent.open_delimiter "[") (#set! indent.close_delimiter "]") . (_))
|
||||
|
||||
(ERROR "{" @aligned_indent (#set! "open_delimiter" "{") (#set! "close_delimiter" "}") . (_))
|
||||
(dictionary "}" @indent_end)
|
||||
(set "}" @indent_end)
|
||||
(ERROR "{" @indent.align (#set! indent.open_delimiter "{") (#set! indent.close_delimiter "}") . (_))
|
||||
|
||||
(parenthesized_expression ")" @indent_end)
|
||||
(generator_expression ")" @indent_end)
|
||||
(list_comprehension "]" @indent_end)
|
||||
(set_comprehension "}" @indent_end)
|
||||
(dictionary_comprehension "}" @indent_end)
|
||||
(parenthesized_expression ")" @indent.end)
|
||||
(generator_expression ")" @indent.end)
|
||||
(list_comprehension "]" @indent.end)
|
||||
(set_comprehension "}" @indent.end)
|
||||
(dictionary_comprehension "}" @indent.end)
|
||||
|
||||
(tuple_pattern ")" @indent_end)
|
||||
(list_pattern "]" @indent_end)
|
||||
(tuple_pattern ")" @indent.end)
|
||||
(list_pattern "]" @indent.end)
|
||||
|
||||
|
||||
(return_statement
|
||||
[
|
||||
(_) @indent_end
|
||||
(_) @indent.end
|
||||
(_
|
||||
[
|
||||
(_)
|
||||
")"
|
||||
"}"
|
||||
"]"
|
||||
] @indent_end .)
|
||||
] @indent.end .)
|
||||
(attribute
|
||||
attribute: (_) @indent_end)
|
||||
attribute: (_) @indent.end)
|
||||
(call
|
||||
arguments: (_ ")" @indent_end))
|
||||
"return" @indent_end
|
||||
arguments: (_ ")" @indent.end))
|
||||
"return" @indent.end
|
||||
] .)
|
||||
|
||||
[
|
||||
|
|
@ -115,7 +109,7 @@
|
|||
(else_clause)
|
||||
(except_clause)
|
||||
(finally_clause)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(string) @auto
|
||||
(string) @indent.auto
|
||||
|
||||
|
|
|
|||
|
|
@ -4,20 +4,20 @@
|
|||
(classMember)
|
||||
(classlessPredicate)
|
||||
(quantified)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
")"
|
||||
"}"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[
|
||||
")"
|
||||
"}"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(block_comment)
|
||||
(line_comment)
|
||||
(qldoc)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
[
|
||||
(list)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @branch
|
||||
] @indent.begin
|
||||
|
|
|
|||
|
|
@ -10,24 +10,24 @@
|
|||
"while"
|
||||
"repeat"
|
||||
"for"
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
((binary operator: (special)) @indent)
|
||||
((binary operator: (special)) @indent.begin)
|
||||
|
||||
[
|
||||
"}"
|
||||
")"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
((formal_parameters (identifier)) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((formal_parameters (identifier)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
[
|
||||
")"
|
||||
"}"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[
|
||||
(comment)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
(rule_set) @indent
|
||||
(rule_set) @indent.begin
|
||||
|
||||
(block "}" @branch)
|
||||
(block "}" @indent.branch)
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
(map)
|
||||
(tuple)
|
||||
(struct)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
|
|
|||
|
|
@ -19,14 +19,14 @@
|
|||
(unless)
|
||||
(assignment)
|
||||
(parenthesized_statements)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"end"
|
||||
")"
|
||||
"}"
|
||||
"]"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[
|
||||
"end"
|
||||
|
|
@ -38,6 +38,6 @@
|
|||
(else)
|
||||
(rescue)
|
||||
(ensure)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -22,38 +22,39 @@
|
|||
(parameters)
|
||||
(token_tree)
|
||||
(macro_definition)
|
||||
] @indent
|
||||
(trait_item body: (_) @indent)
|
||||
(string_literal (escape_sequence)) @indent
|
||||
] @indent.begin
|
||||
(trait_item body: (_) @indent.begin)
|
||||
(string_literal (escape_sequence)) @indent.begin
|
||||
|
||||
(block "}" @indent_end)
|
||||
(block "}" @indent.end)
|
||||
(enum_item
|
||||
body: (enum_variant_list "}" @indent_end))
|
||||
body: (enum_variant_list "}" @indent.end))
|
||||
(impl_item
|
||||
body: (declaration_list "}" @indent_end))
|
||||
body: (declaration_list "}" @indent.end))
|
||||
(match_expression
|
||||
body: (match_block "}" @indent_end))
|
||||
body: (match_block "}" @indent.end))
|
||||
(mod_item
|
||||
body: (declaration_list "}" @indent_end))
|
||||
body: (declaration_list "}" @indent.end))
|
||||
(struct_item
|
||||
body: (field_declaration_list "}" @indent_end))
|
||||
body: (field_declaration_list "}" @indent.end))
|
||||
(trait_item
|
||||
body: (declaration_list "}" @indent_end))
|
||||
body: (declaration_list "}" @indent.end))
|
||||
|
||||
(impl_item (where_clause) @dedent)
|
||||
(impl_item (where_clause) @indent.dedent)
|
||||
|
||||
[
|
||||
"where"
|
||||
")"
|
||||
"]"
|
||||
"}"
|
||||
] @branch
|
||||
(impl_item (declaration_list) @branch)
|
||||
] @indent.branch
|
||||
(impl_item (declaration_list) @indent.branch)
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(string_literal)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
||||
|
||||
(raw_string_literal) @auto
|
||||
(raw_string_literal) @indent.auto
|
||||
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@
|
|||
(mixin_statement)
|
||||
(while_statement)
|
||||
(each_statement)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
(handler_body)
|
||||
(consequence_body)
|
||||
(global_single)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
"}" @indent_end
|
||||
"}" @indent.end
|
||||
|
||||
(comment) @auto
|
||||
(comment) @indent.auto
|
||||
|
||||
(string_literal) @auto
|
||||
(string_literal) @indent.auto
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
(sparse_switch_directive)
|
||||
(subannotation_directive)
|
||||
(list)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
".end annotation"
|
||||
|
|
@ -22,11 +22,11 @@
|
|||
".end sparse-switch"
|
||||
".end subannotation"
|
||||
"}"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
(data_block)
|
||||
(blank_node_property_list)
|
||||
(collection)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
[
|
||||
"}"
|
||||
"]"
|
||||
")"
|
||||
(triples_same_subject)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
|
|
|||
|
|
@ -15,39 +15,39 @@
|
|||
(foreach_statement)
|
||||
; (try_statement)
|
||||
(catch_statement)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(
|
||||
(if_statement)
|
||||
(ERROR "else") @indent
|
||||
(ERROR "else") @indent.begin
|
||||
)
|
||||
|
||||
(if_statement
|
||||
condition: (_) @indent)
|
||||
condition: (_) @indent.begin)
|
||||
|
||||
(if_statement
|
||||
consequence: (_)
|
||||
(else_statement) @indent)
|
||||
(else_statement) @indent.begin)
|
||||
|
||||
(do_while_statement
|
||||
"do"
|
||||
(_) @indent)
|
||||
(_) @indent.begin)
|
||||
|
||||
(try_statement
|
||||
(_) @indent
|
||||
(catch_statement) @indent)
|
||||
(_) @indent.begin
|
||||
(catch_statement) @indent.begin)
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[
|
||||
"}"
|
||||
")"
|
||||
"]"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
|
|
@ -55,4 +55,4 @@
|
|||
|
||||
(string)
|
||||
(verbatim_string)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -19,28 +19,28 @@
|
|||
|
||||
(lambda)
|
||||
(function_definition)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(if_statement
|
||||
condition: (parenthesized_expression) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")")
|
||||
condition: (parenthesized_expression) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
)
|
||||
((ERROR "(" . (_)) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((argument_list) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((argument_list) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((parameters) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((tuple) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((ERROR "(" . (_)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
((argument_list) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
((argument_list) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
((parameters) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
((tuple) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
[
|
||||
")"
|
||||
|
|
@ -48,6 +48,6 @@
|
|||
"}"
|
||||
(elif_clause)
|
||||
(else_clause)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(string) @auto
|
||||
(string) @indent.auto
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
(variable_definition_sequence (variable_definition))
|
||||
(control_structure)
|
||||
(return_statement)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
(parameter_call_list (argument_calls))
|
||||
|
|
@ -23,9 +23,9 @@
|
|||
"}"
|
||||
"["
|
||||
"]"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(block_comment)
|
||||
(line_comment)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
(component)
|
||||
(tag)
|
||||
(block)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
; Dedent at the end of each tag, as well as a subblock
|
||||
[
|
||||
|
|
@ -11,4 +11,4 @@
|
|||
(end_component)
|
||||
(end_block)
|
||||
(subblock)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
(await_statement)
|
||||
(script_element)
|
||||
(style_element)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
(end_tag)
|
||||
|
|
@ -15,6 +15,6 @@
|
|||
(await_end_expr)
|
||||
">"
|
||||
"/>"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -9,19 +9,19 @@
|
|||
(if)
|
||||
(let)
|
||||
(value_suffix)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"}"
|
||||
"]"
|
||||
")"
|
||||
">"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[ "<" ">" ] @branch
|
||||
[ "<" ">" ] @indent.branch
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
(if_statement)
|
||||
(return_statement)
|
||||
(while_statement)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"{"
|
||||
|
|
@ -15,4 +15,4 @@
|
|||
")"
|
||||
"end"
|
||||
"then"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
(definition) @indent
|
||||
(definition) @indent.begin
|
||||
|
||||
((parameters (parameter)) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((parameters (parameter)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
"}" @indent_end
|
||||
"}" @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -1,69 +1,69 @@
|
|||
; Control flow {{{
|
||||
(if_expression) @indent
|
||||
"then" @branch
|
||||
"else" @branch
|
||||
(if_expression) @indent.begin
|
||||
"then" @indent.branch
|
||||
"else" @indent.branch
|
||||
|
||||
(while_expression) @indent
|
||||
"do" @branch
|
||||
(while_expression) @indent.begin
|
||||
"do" @indent.branch
|
||||
|
||||
(for_expression) @indent
|
||||
"to" @branch
|
||||
(for_expression) @indent.begin
|
||||
"to" @indent.branch
|
||||
; }}}
|
||||
|
||||
; Class {{{
|
||||
(class_declaration) @indent
|
||||
(class_declaration "}" @indent_end)
|
||||
(class_declaration) @indent.begin
|
||||
(class_declaration "}" @indent.end)
|
||||
|
||||
(class_type) @indent
|
||||
(class_type "}" @indent_end)
|
||||
(class_type) @indent.begin
|
||||
(class_type "}" @indent.end)
|
||||
; }}}
|
||||
|
||||
; Groups {{{
|
||||
(let_expression) @indent
|
||||
"in" @branch
|
||||
"end" @branch
|
||||
(let_expression "end" @indent_end)
|
||||
(let_expression) @indent.begin
|
||||
"in" @indent.branch
|
||||
"end" @indent.branch
|
||||
(let_expression "end" @indent.end)
|
||||
|
||||
(sequence_expression) @indent
|
||||
")" @branch
|
||||
(sequence_expression ")" @indent_end)
|
||||
(sequence_expression) @indent.begin
|
||||
")" @indent.branch
|
||||
(sequence_expression ")" @indent.end)
|
||||
; }}}
|
||||
|
||||
; Functions and methods {{{
|
||||
(parameters) @indent
|
||||
(parameters ")" @indent_end)
|
||||
(parameters) @indent.begin
|
||||
(parameters ")" @indent.end)
|
||||
|
||||
(function_call) @indent
|
||||
(method_call) @indent
|
||||
")" @branch
|
||||
(function_call) @indent.begin
|
||||
(method_call) @indent.begin
|
||||
")" @indent.branch
|
||||
|
||||
(function_declaration) @indent
|
||||
(primitive_declaration) @indent
|
||||
(method_declaration) @indent
|
||||
(function_declaration) @indent.begin
|
||||
(primitive_declaration) @indent.begin
|
||||
(method_declaration) @indent.begin
|
||||
; }}}
|
||||
|
||||
; Values and expressions {{{
|
||||
(array_value) @indent
|
||||
"]" @branch
|
||||
(array_value "]" @indent_end)
|
||||
(array_value) @indent.begin
|
||||
"]" @indent.branch
|
||||
(array_value "]" @indent.end)
|
||||
|
||||
(array_expression) @indent
|
||||
"of" @branch
|
||||
(array_expression) @indent.begin
|
||||
"of" @indent.branch
|
||||
|
||||
(record_expression) @indent
|
||||
"}" @branch
|
||||
(record_expression "}" @indent_end)
|
||||
(record_expression) @indent.begin
|
||||
"}" @indent.branch
|
||||
(record_expression "}" @indent.end)
|
||||
|
||||
(record_type) @indent
|
||||
"}" @branch
|
||||
(record_type "}" @indent_end)
|
||||
(record_type) @indent.begin
|
||||
"}" @indent.branch
|
||||
(record_type "}" @indent.end)
|
||||
|
||||
(variable_declaration) @indent
|
||||
(variable_declaration) @indent.begin
|
||||
; }}}
|
||||
|
||||
; Misc{{{
|
||||
(comment) @ignore
|
||||
(string_literal) @ignore
|
||||
(comment) @indent.ignore
|
||||
(string_literal) @indent.ignore
|
||||
; }}}
|
||||
|
||||
; vim: sw=2 foldmethod=marker
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
[
|
||||
(array)
|
||||
(inline_table)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
(statement)
|
||||
(blank_node_property_list)
|
||||
(collection)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
[
|
||||
"]"
|
||||
")"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@
|
|||
(enum_declaration)
|
||||
(interface_declaration)
|
||||
(object_type)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
(node) @indent
|
||||
(node) @indent.begin
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
(memory_execution) @auto
|
||||
(memory_execution) @indent.auto
|
||||
|
||||
[
|
||||
(subroutine)
|
||||
(brackets)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
"}" @indent_end
|
||||
"}" @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
(map)
|
||||
(call_expression)
|
||||
(parameter_list)]
|
||||
@indent
|
||||
@indent.begin
|
||||
|
||||
[ "}"]
|
||||
@branch
|
||||
@indent.branch
|
||||
|
||||
(parameter_list ")" @branch)
|
||||
(parameter_list ")" @indent.branch)
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
[
|
||||
(template_element)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(template_element (end_tag ">" @indent_end) @branch)
|
||||
(template_element (end_tag ">" @indent.end) @indent.branch)
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@
|
|||
(compound_statement)
|
||||
(loop_statement)
|
||||
(struct_declaration)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(compound_statement "}" @indent_end)
|
||||
(loop_statement "}" @indent_end)
|
||||
(function_declaration ")" @indent_end)
|
||||
(struct_declaration "}" @indent_end)
|
||||
(compound_statement "}" @indent.end)
|
||||
(loop_statement "}" @indent.end)
|
||||
(function_declaration ")" @indent.end)
|
||||
(struct_declaration "}" @indent.end)
|
||||
|
||||
[
|
||||
"else"
|
||||
")"
|
||||
"}"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[(line_comment) (block_comment)] @auto
|
||||
[(line_comment) (block_comment)] @indent.auto
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@
|
|||
"#ifndef"
|
||||
"#else"
|
||||
"#endif"
|
||||
] @zero_indent
|
||||
] @indent.zero
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[
|
||||
(block_mapping_pair value: (block_node))
|
||||
(block_sequence_item)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(ERROR) @auto
|
||||
(ERROR) @indent.auto
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
(module) @indent
|
||||
(submodule) @indent
|
||||
(statement) @indent
|
||||
(extension_statement) @indent
|
||||
(statement ";" @indent_end)
|
||||
(extension_statement ";" @indent_end)
|
||||
(block "}" @indent_end @branch)
|
||||
(module) @indent.begin
|
||||
(submodule) @indent.begin
|
||||
(statement) @indent.begin
|
||||
(extension_statement) @indent.begin
|
||||
(statement ";" @indent.end)
|
||||
(extension_statement ";" @indent.end)
|
||||
(block "}" @indent.end @indent.branch)
|
||||
|
||||
((string) @aligned_indent
|
||||
(#set! "open_delimiter" "\"")
|
||||
(#set! "close_delimiter" "\""))
|
||||
((string) @indent.align
|
||||
(#set! indent.open_delimiter "\"")
|
||||
(#set! indent.close_delimiter "\""))
|
||||
|
|
|
|||
|
|
@ -5,22 +5,22 @@
|
|||
(json_array)
|
||||
(json_object)
|
||||
(parenthesized_expression)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
; TODO: can't get this to work, goal is to indent at the property ":" prefix
|
||||
; ((list (identifier) (property)) @aligned_indent
|
||||
; (#set! "open_delimiter" "(")
|
||||
; (#set! "close_delimiter" ")"))
|
||||
; ((list (identifier) (property)) @indent.align
|
||||
; (#set! indent.open_delimiter "(")
|
||||
; (#set! indent.close_delimiter ")"))
|
||||
|
||||
[")" "}" "]"] @indent_end
|
||||
[")" "}" "]"] @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
(ContainerDecl)
|
||||
(SwitchExpr)
|
||||
(InitList)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(Block "}" @indent_end)
|
||||
(Block "}" @indent.end)
|
||||
|
||||
[
|
||||
"("
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(container_doc_comment)
|
||||
(doc_comment)
|
||||
(LINESTRING)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue