aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/python
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/queries/python')
-rw-r--r--runtime/queries/python/highlights.scm11
-rw-r--r--runtime/queries/python/indents.toml39
-rw-r--r--runtime/queries/python/textobjects.scm14
3 files changed, 57 insertions, 7 deletions
diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm
index f64fecb2..9131acc5 100644
--- a/runtime/queries/python/highlights.scm
+++ b/runtime/queries/python/highlights.scm
@@ -29,7 +29,7 @@
name: (identifier) @function)
(identifier) @variable
-(attribute attribute: (identifier) @property)
+(attribute attribute: (identifier) @variable.other.member)
(type (identifier) @type)
; Literals
@@ -40,14 +40,11 @@
(false)
] @constant.builtin
-[
- (integer)
- (float)
-] @number
-
+(integer) @constant.numeric.integer
+(float) @constant.numeric.float
(comment) @comment
(string) @string
-(escape_sequence) @escape
+(escape_sequence) @constant.character.escape
(interpolation
"{" @punctuation.special
diff --git a/runtime/queries/python/indents.toml b/runtime/queries/python/indents.toml
new file mode 100644
index 00000000..6bc68486
--- /dev/null
+++ b/runtime/queries/python/indents.toml
@@ -0,0 +1,39 @@
+indent = [
+ "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",
+]
+
+outdent = [
+ ")",
+ "]",
+ "}",
+ "return_statement",
+ "pass_statement",
+ "raise_statement",
+]
+
+ignore = ["string"]
diff --git a/runtime/queries/python/textobjects.scm b/runtime/queries/python/textobjects.scm
new file mode 100644
index 00000000..a52538af
--- /dev/null
+++ b/runtime/queries/python/textobjects.scm
@@ -0,0 +1,14 @@
+(function_definition
+ body: (block)? @function.inside) @function.around
+
+(class_definition
+ body: (block)? @class.inside) @class.around
+
+(parameters
+ (_) @parameter.inside)
+
+(lambda_parameters
+ (_) @parameter.inside)
+
+(argument_list
+ (_) @parameter.inside)