From 9fd742d35e3579af47748133921392ec5ed8597a Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Thu, 23 Apr 2026 22:49:13 +0200 Subject: [PATCH] fix(python): update queries for expression_statement supertype --- queries/python/highlights.scm | 18 +++++++++++++++--- queries/python/indents.scm | 7 +++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/queries/python/highlights.scm b/queries/python/highlights.scm index 1b046d6..0e4dbcc 100644 --- a/queries/python/highlights.scm +++ b/queries/python/highlights.scm @@ -1,5 +1,10 @@ ; From tree-sitter-python licensed under MIT License ; Copyright (c) 2016 Max Brunsfeld +; +; Modified from nvim-treesitter (https://github.com/nvim-treesitter/nvim-treesitter) +; Modifications Copyright 2026 Oscar Wallberg +; Licensed under Apache-2.0 +; ; Variables (identifier) @variable @@ -80,9 +85,16 @@ ] @string.escape ; doc-strings -(expression_statement - (string - (string_content) @spell) @string.documentation) +[ + (module + . + (string + (string_content) @spell) @string.documentation) + (block + . + (string + (string_content) @spell) @string.documentation) +] ; Tokens [ diff --git a/queries/python/indents.scm b/queries/python/indents.scm index 2414812..dff1251 100644 --- a/queries/python/indents.scm +++ b/queries/python/indents.scm @@ -1,3 +1,7 @@ +; Modified from nvim-treesitter (https://github.com/nvim-treesitter/nvim-treesitter) +; Modifications Copyright 2026 Oscar Wallberg +; Licensed under Apache-2.0 + [ (import_from_statement) (generator_expression) @@ -51,8 +55,7 @@ ":" (ERROR (block - (expression_statement - (identifier) @_except) @indent.branch)) + (identifier) @_except @indent.branch)) (#eq? @_except "except")) ((function_definition) @indent.begin