nvim-treesitter/runtime/queries/ocaml/indents.scm

78 lines
1.5 KiB
Scheme
Raw Permalink Normal View History

; format-ignore
[
(let_binding) ; let = ...
(type_binding)
(external)
(record_declaration) ; { foo: bar ... }
(structure) ; struct ... end
(signature) ; sig ... end
(value_specification) ; val x: bar
(do_clause) ; do ... done
(match_case)
(field_expression)
(application_expression)
(parenthesized_expression) ; ( ... )
(record_expression) ; { foo = bar ... }
(list_expression) ; [...;...]
(try_expression) ; try ... with
] @indent.begin
; handle if-else if-else case
(if_expression
condition: (_) @indent.begin)
2024-01-06 15:05:50 +09:00
(then_clause) @indent.begin
2024-01-06 15:05:50 +09:00
((else_clause
(_) @_not_if) @indent.begin
(#not-kind-eq? @_not_if "if_expression"))
2024-01-06 15:05:50 +09:00
((parameter) @indent.begin
(#set! indent.start_at_same_line))
2024-01-06 15:05:50 +09:00
(_
(ERROR) @indent.begin
(#set! indent.start_at_same_line))
2024-01-06 15:05:50 +09:00
(ERROR
"|" @indent.begin
(#set! indent.start_at_same_line))
(try_expression
"with" @indent.branch
[
(match_case) @indent.dedent
2024-01-06 15:05:50 +09:00
(match_case
[
2024-01-06 15:05:50 +09:00
(parenthesized_expression)
(list_expression)
] @indent.dedent)
2024-01-06 15:05:50 +09:00
])
2024-01-06 15:05:50 +09:00
"}" @indent.branch @indent.end
2024-01-06 15:05:50 +09:00
(list_expression
"]" @indent.branch)
2024-01-06 15:05:50 +09:00
(parenthesized_expression
")" @indent.branch)
";;" @indent.end
2024-01-06 15:05:50 +09:00
(do_clause
"done" @indent.end @indent.branch)
(structure
"end" @indent.end @indent.branch)
(signature
"end" @indent.end @indent.branch)
[
(string)
2024-01-06 15:05:50 +09:00
(comment)
] @indent.auto