From 0727c26180fa921399b596ba9108fe40ff661e15 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Mon, 11 Mar 2024 17:30:19 -0400 Subject: [PATCH] Fix a raw string replacement --- build-flavored-queries.py | 49 +++++++++++----------- queries-flavored/nvim-next/textobjects.scm | 10 ++--- 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/build-flavored-queries.py b/build-flavored-queries.py index 1eac62f..92bda80 100755 --- a/build-flavored-queries.py +++ b/build-flavored-queries.py @@ -186,23 +186,22 @@ # Old nvim-treesitter before updates REPLACEMENTS_NVIM_OLD = [ # Changes to local captures - (r"@local.definition", "@definition"), - (r"@local.reference[\w.]*", "@reference"), - (r"@local.scope", "@scope"), + (r"@local.definition", r"@definition"), + (r"@local.reference[\w.]*", r"@reference"), + (r"@local.scope", r"@scope"), # Changes to highlight queries - (r"@comment.line", "@comment"), - (r"@comment.around", "@comment.outer"), - (r"@constant.builtin.boolean", "@boolean"), + (r"@comment.line", r"@comment"), + (r"@constant.builtin.boolean", r"@boolean"), (r"@constant.character.escape", "@string.escape"), - (r"@keyword.control.conditional", "@conditional"), - (r"@keyword.control.import", "@keyword"), - (r"@keyword.module", "@keyword"), - (r"@variable.parameter", "@parameter"), + (r"@keyword.control.conditional", r"@conditional"), + (r"@keyword.control.import", r"@keyword"), + (r"@keyword.module", r"@keyword"), + (r"@variable.parameter", r"@parameter"), # Changes to indent queries - (r"@indent\s+@extend", "@indent.begin"), + (r"@indent\s+@extend", r"@indent.begin"), # Changes to textobject queries - (r"(@[\w.]+.)inside", r"\1inner"), - (r"(@[\w.]+.)around", r"\1outer"), + (r"(@[\w.]+\.)inside", r"\1inner"), + (r"(@[\w.]+\.)around", r"\1outer"), # nvim uses `var` rather than `variable` (r"(@[\w.]+)\.variable", r"\1.var"), ] @@ -326,17 +325,17 @@ # Old nvim-treesitter before updates REPLACEMENTS_NVIM = [ # Changes to highlight queries - (r"@comment.line", "@comment"), - (r"@constant.builtin.boolean", "@boolean"), - (r"@constant.character.escape", "@string.escape"), - (r"@keyword.module", "@module"), - (r"@keyword.control.", "@keyword."), - (r"@namespace", "@module"), + (r"@comment.line", r"@comment"), + (r"@constant.builtin.boolean", r"@boolean"), + (r"@constant.character.escape", r"@string.escape"), + (r"@keyword.module", r"@module"), + (r"@keyword.control.", r"@keyword."), + (r"@namespace", r"@module"), # Changes to indent queries - (r"@indent\s+@extend", "@indent.begin"), + (r"@indent\s+@extend", r"@indent.begin"), # Changes to textobject queries - (r"(@[\w.]+).inside", "\1.inner"), - (r"(@[\w.]+).around", "\1.outer"), + (r"(@[\w.]+\.)inside", r"\1inner"), + (r"(@[\w.]+\.)around", r"\1outer"), # nvim uses `var` rather than `variable` (r"(@[\w.]+)\.variable", r"\1.var"), # nothing more specific than reference @@ -443,9 +442,9 @@ } REPLACEMENTS_HELIX = [ - (r"@keyword.module", "@keyword.directive"), - (r"@function.call", "@function"), - (r"@spell ?", ""), + (r"@keyword.module", r"@keyword.directive"), + (r"@function.call", r"@function"), + (r"@spell ?", r""), # nothing more specific than reference (r"(@local.reference)[\w.]+", r"\1"), ] diff --git a/queries-flavored/nvim-next/textobjects.scm b/queries-flavored/nvim-next/textobjects.scm index 95d40cf..2894a8b 100644 --- a/queries-flavored/nvim-next/textobjects.scm +++ b/queries-flavored/nvim-next/textobjects.scm @@ -3,16 +3,16 @@ ; Specify how to navigate around logical blocks in code (recipe - (recipe_body) .inner) .outer + (recipe_body) @function.inner) @function.outer (parameters - ((_) .inner . ","? .outer)) .outer + ((_) @parameter.inner . ","? @parameter.outer)) @parameter.outer (dependency_expression - (_) .inner) .outer + (_) @parameter.inner) @parameter.outer (function_call arguments: (sequence - (expression) .inner) .outer) .outer + (expression) @parameter.inner) @parameter.outer) @function.outer -(comment) .outer +(comment) @comment.outer