summaryrefslogtreecommitdiff
path: root/vendor/queries/python
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 03:35:02 -0300
committerGabriel Schneider <[email protected]>2026-11-10 04:08:16 -0300
commite398c24ba19948727affdc6a29254ac69a6b7699 (patch)
tree0770792049a135447b54be2a52367233e786c654 /vendor/queries/python
parent22b981446238977d9c3f85eb4856324a9daa9753 (diff)
downloadpardes-e398c24ba19948727affdc6a29254ac69a6b7699.tar.gz
pardes-e398c24ba19948727affdc6a29254ac69a6b7699.zip
syntax: helix's indents.scm vendored beside each grammar's textobjects.scm and embedded the same way (zig's adapted to this grammar's node names, rust's \A regexes written with ^, erlang's left out as it does not compile here), compiled when first asked for as a Lazy beside the textobjects, so a new line can take its indent from the tree
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'vendor/queries/python')
-rw-r--r--vendor/queries/python/indents.scm98
1 files changed, 98 insertions, 0 deletions
diff --git a/vendor/queries/python/indents.scm b/vendor/queries/python/indents.scm
new file mode 100644
index 00000000..6e49c2fd
--- /dev/null
+++ b/vendor/queries/python/indents.scm
@@ -0,0 +1,98 @@
+; Vendored from helix (https://github.com/helix-editor/helix) at 278b24389:
+; runtime/queries/python/indents.scm.
+; Licensed under the Mozilla Public License 2.0 (vendor/queries/helix.LICENSE,
+; https://mozilla.org/MPL/2.0/).
+
+[
+ (list)
+ (tuple)
+ (dictionary)
+ (set)
+
+ (if_statement)
+ (for_statement)
+ (while_statement)
+ (with_statement)
+ (try_statement)
+ (match_statement)
+ (case_clause)
+ (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
+
+; Workaround for the tree-sitter grammar creating large errors when a
+; try_statement is missing the except/finally clause
+(ERROR
+ "try"
+ .
+ ":" @indent @extend)
+(ERROR
+ .
+ "def") @indent @extend
+(ERROR
+ (block) @indent @extend
+ )
+
+[
+ (if_statement)
+ (for_statement)
+ (while_statement)
+ (with_statement)
+ (try_statement)
+ (match_statement)
+ (case_clause)
+
+ (function_definition)
+ (class_definition)
+
+ (except_clause)
+ (finally_clause)
+] @extend
+
+[
+ (return_statement)
+ (break_statement)
+ (continue_statement)
+ (raise_statement)
+ (pass_statement)
+] @extend.prevent-once
+
+[
+ ")"
+ "]"
+ "}"
+] @outdent
+(elif_clause
+ "elif" @outdent)
+(else_clause
+ "else" @outdent)
+(except_clause
+ "except" @outdent)
+(finally_clause
+ "finally" @outdent)
+
+(parameters
+ .
+ (identifier) @anchor
+ ) @align
+(argument_list
+ .
+ (_) @anchor
+ ) @align
+
+; String bodies (triple-quoted strings span lines) are literal content.
+(string) @opaque