From 3ab9abb64283aed54f5ea7e8157629c2a2be3b33 Mon Sep 17 00:00:00 2001 From: Triton171 Date: Tue, 9 Aug 2022 22:32:13 +0200 Subject: Add `extend-indented` and `stop-extend` captures for indent queries. Improve and re-enable python indent queries. --- runtime/queries/python/indents.scm | 58 +++++++++++++++++++++++++++++++++++++ runtime/queries/python/indents.scm_ | 38 ------------------------ 2 files changed, 58 insertions(+), 38 deletions(-) create mode 100644 runtime/queries/python/indents.scm delete mode 100644 runtime/queries/python/indents.scm_ (limited to 'runtime/queries') diff --git a/runtime/queries/python/indents.scm b/runtime/queries/python/indents.scm new file mode 100644 index 00000000..c648aebc --- /dev/null +++ b/runtime/queries/python/indents.scm @@ -0,0 +1,58 @@ +[ + (list) + (tuple) + (dictionary) + (set) + + (if_statement) + (for_statement) + (while_statement) + (with_statement) + (try_statement) + (import_from_statement) + + (parenthesized_expression) + (generator_expression) + (list_comprehension) + (set_comprehension) + (dictionary_comprehension) + + (tuple_pattern) + (list_pattern) + (argument_list) + (parameters) + (binary_operator) + + (function_definition) + (class_definition) +] @indent + +[ + (if_statement) + (for_statement) + (while_statement) + (with_statement) + (try_statement) + + (function_definition) + (class_definition) +] @extend-indented + +[ + (return_statement) + (break_statement) + (continue_statement) + (raise_statement) + (pass_statement) +] @stop-extend + +[ + ")" + "]" + "}" +] @outdent +(elif_clause + "elif" @outdent) +(else_clause + "else" @outdent) + diff --git a/runtime/queries/python/indents.scm_ b/runtime/queries/python/indents.scm_ deleted file mode 100644 index 810ff52f..00000000 --- a/runtime/queries/python/indents.scm_ +++ /dev/null @@ -1,38 +0,0 @@ -[ - (list) - (tuple) - (dictionary) - (set) - - (if_statement) - (for_statement) - (while_statement) - (with_statement) - (try_statement) - (import_from_statement) - - (parenthesized_expression) - (generator_expression) - (list_comprehension) - (set_comprehension) - (dictionary_comprehension) - - (tuple_pattern) - (list_pattern) - (argument_list) - (parameters) - (binary_operator) - - (function_definition) - (class_definition) -] @indent - -[ - ")" - "]" - "}" - (return_statement) - (pass_statement) - (raise_statement) -] @outdent - -- cgit v1.2.3-70-g09d2