diff --git a/build-flavored-queries.py b/build-flavored-queries.py index 92bda80..2c45f4f 100755 --- a/build-flavored-queries.py +++ b/build-flavored-queries.py @@ -542,6 +542,7 @@ def main(): # Remove trailing whitespace and duplicate newlines contents = re.sub(r"[\s;]+$", "", contents) + contents = "\n".join((line.rstrip() for line in contents.splitlines())) contents = re.sub(r"((?:\r?\n){2,})(?:\r?\n)+", r"\1", contents) if not contents.endswith("\n"): diff --git a/queries-flavored/helix/injections.scm b/queries-flavored/helix/injections.scm index c8035d5..b19b61b 100644 --- a/queries-flavored/helix/injections.scm +++ b/queries-flavored/helix/injections.scm @@ -74,9 +74,9 @@ (command_body) @injection.content)))) ]) -; ================ Recipe language specified - Helix only ================ - -; Set highlighting for recipes that specify a language using builtin shebang matching -(recipe_body - (shebang) @injection.shebang +; ================ Recipe language specified - Helix only ================ + +; Set highlighting for recipes that specify a language using builtin shebang matching +(recipe_body + (shebang) @injection.shebang (#set! injection.include-children)) @injection.content diff --git a/queries-flavored/helix/textobjects.scm b/queries-flavored/helix/textobjects.scm index bf988e3..2e0c9e3 100644 --- a/queries-flavored/helix/textobjects.scm +++ b/queries-flavored/helix/textobjects.scm @@ -2,10 +2,10 @@ ; Specify how to navigate around logical blocks in code -(recipe +(recipe (recipe_body) @function.inside) @function.around -(parameters +(parameters ((_) @parameter.inside . ","? @parameter.around)) @parameter.around (dependency_expression diff --git a/queries-flavored/lapce/injections.scm b/queries-flavored/lapce/injections.scm index 5309c20..73084bc 100644 --- a/queries-flavored/lapce/injections.scm +++ b/queries-flavored/lapce/injections.scm @@ -74,29 +74,29 @@ (command_body) @injection.content)))) ]) -; ================ Recipe language specified ================ - -; Set highlighting for recipes that specify a language, using the exact name by default -(recipe_body ; - (shebang ; - (language) @injection.language) ; - (#not-any-of? @injection.language "python3" "nodejs" "node") - (#set! injection.include-children)) @injection.content - -; Transform some known executables - -; python3 -> python -(recipe_body - (shebang - (language) @_lang) - (#eq? @_lang "python3") - (#set! injection.language "python") - (#set! injection.include-children)) @injection.content - -; node/nodejs -> javascript -(recipe_body - (shebang - (language) @_lang) - (#any-of? @_lang "node" "nodejs") - (#set! injection.language "javascript") +; ================ Recipe language specified ================ + +; Set highlighting for recipes that specify a language, using the exact name by default +(recipe_body ; + (shebang ; + (language) @injection.language) ; + (#not-any-of? @injection.language "python3" "nodejs" "node") + (#set! injection.include-children)) @injection.content + +; Transform some known executables + +; python3 -> python +(recipe_body + (shebang + (language) @_lang) + (#eq? @_lang "python3") + (#set! injection.language "python") + (#set! injection.include-children)) @injection.content + +; node/nodejs -> javascript +(recipe_body + (shebang + (language) @_lang) + (#any-of? @_lang "node" "nodejs") + (#set! injection.language "javascript") (#set! injection.include-children)) @injection.content diff --git a/queries-flavored/lapce/textobjects.scm b/queries-flavored/lapce/textobjects.scm index bf988e3..2e0c9e3 100644 --- a/queries-flavored/lapce/textobjects.scm +++ b/queries-flavored/lapce/textobjects.scm @@ -2,10 +2,10 @@ ; Specify how to navigate around logical blocks in code -(recipe +(recipe (recipe_body) @function.inside) @function.around -(parameters +(parameters ((_) @parameter.inside . ","? @parameter.around)) @parameter.around (dependency_expression diff --git a/queries-flavored/nvim-next/injections.scm b/queries-flavored/nvim-next/injections.scm index f1d1697..79315fb 100644 --- a/queries-flavored/nvim-next/injections.scm +++ b/queries-flavored/nvim-next/injections.scm @@ -72,29 +72,29 @@ (command_body) @injection.content)))) ]) -; ================ Recipe language specified ================ - -; Set highlighting for recipes that specify a language, using the exact name by default -(recipe_body ; - (shebang ; - (language) @injection.language) ; - (#not-any-of? @injection.language "python3" "nodejs" "node") - (#set! injection.include-children)) @injection.content - -; Transform some known executables - -; python3 -> python -(recipe_body - (shebang - (language) @_lang) - (#eq? @_lang "python3") - (#set! injection.language "python") - (#set! injection.include-children)) @injection.content - -; node/nodejs -> javascript -(recipe_body - (shebang - (language) @_lang) - (#any-of? @_lang "node" "nodejs") - (#set! injection.language "javascript") +; ================ Recipe language specified ================ + +; Set highlighting for recipes that specify a language, using the exact name by default +(recipe_body ; + (shebang ; + (language) @injection.language) ; + (#not-any-of? @injection.language "python3" "nodejs" "node") + (#set! injection.include-children)) @injection.content + +; Transform some known executables + +; python3 -> python +(recipe_body + (shebang + (language) @_lang) + (#eq? @_lang "python3") + (#set! injection.language "python") + (#set! injection.include-children)) @injection.content + +; node/nodejs -> javascript +(recipe_body + (shebang + (language) @_lang) + (#any-of? @_lang "node" "nodejs") + (#set! injection.language "javascript") (#set! injection.include-children)) @injection.content diff --git a/queries-flavored/nvim-next/textobjects.scm b/queries-flavored/nvim-next/textobjects.scm index 2894a8b..b010a8e 100644 --- a/queries-flavored/nvim-next/textobjects.scm +++ b/queries-flavored/nvim-next/textobjects.scm @@ -2,10 +2,10 @@ ; Specify how to navigate around logical blocks in code -(recipe +(recipe (recipe_body) @function.inner) @function.outer -(parameters +(parameters ((_) @parameter.inner . ","? @parameter.outer)) @parameter.outer (dependency_expression diff --git a/queries-flavored/zed/injections.scm b/queries-flavored/zed/injections.scm index 5309c20..73084bc 100644 --- a/queries-flavored/zed/injections.scm +++ b/queries-flavored/zed/injections.scm @@ -74,29 +74,29 @@ (command_body) @injection.content)))) ]) -; ================ Recipe language specified ================ - -; Set highlighting for recipes that specify a language, using the exact name by default -(recipe_body ; - (shebang ; - (language) @injection.language) ; - (#not-any-of? @injection.language "python3" "nodejs" "node") - (#set! injection.include-children)) @injection.content - -; Transform some known executables - -; python3 -> python -(recipe_body - (shebang - (language) @_lang) - (#eq? @_lang "python3") - (#set! injection.language "python") - (#set! injection.include-children)) @injection.content - -; node/nodejs -> javascript -(recipe_body - (shebang - (language) @_lang) - (#any-of? @_lang "node" "nodejs") - (#set! injection.language "javascript") +; ================ Recipe language specified ================ + +; Set highlighting for recipes that specify a language, using the exact name by default +(recipe_body ; + (shebang ; + (language) @injection.language) ; + (#not-any-of? @injection.language "python3" "nodejs" "node") + (#set! injection.include-children)) @injection.content + +; Transform some known executables + +; python3 -> python +(recipe_body + (shebang + (language) @_lang) + (#eq? @_lang "python3") + (#set! injection.language "python") + (#set! injection.include-children)) @injection.content + +; node/nodejs -> javascript +(recipe_body + (shebang + (language) @_lang) + (#any-of? @_lang "node" "nodejs") + (#set! injection.language "javascript") (#set! injection.include-children)) @injection.content diff --git a/queries-flavored/zed/textobjects.scm b/queries-flavored/zed/textobjects.scm index bf988e3..2e0c9e3 100644 --- a/queries-flavored/zed/textobjects.scm +++ b/queries-flavored/zed/textobjects.scm @@ -2,10 +2,10 @@ ; Specify how to navigate around logical blocks in code -(recipe +(recipe (recipe_body) @function.inside) @function.around -(parameters +(parameters ((_) @parameter.inside . ","? @parameter.around)) @parameter.around (dependency_expression diff --git a/queries/just/injections.scm b/queries/just/injections.scm index f1d1697..79315fb 100644 --- a/queries/just/injections.scm +++ b/queries/just/injections.scm @@ -72,29 +72,29 @@ (command_body) @injection.content)))) ]) -; ================ Recipe language specified ================ - -; Set highlighting for recipes that specify a language, using the exact name by default -(recipe_body ; - (shebang ; - (language) @injection.language) ; - (#not-any-of? @injection.language "python3" "nodejs" "node") - (#set! injection.include-children)) @injection.content - -; Transform some known executables - -; python3 -> python -(recipe_body - (shebang - (language) @_lang) - (#eq? @_lang "python3") - (#set! injection.language "python") - (#set! injection.include-children)) @injection.content - -; node/nodejs -> javascript -(recipe_body - (shebang - (language) @_lang) - (#any-of? @_lang "node" "nodejs") - (#set! injection.language "javascript") +; ================ Recipe language specified ================ + +; Set highlighting for recipes that specify a language, using the exact name by default +(recipe_body ; + (shebang ; + (language) @injection.language) ; + (#not-any-of? @injection.language "python3" "nodejs" "node") + (#set! injection.include-children)) @injection.content + +; Transform some known executables + +; python3 -> python +(recipe_body + (shebang + (language) @_lang) + (#eq? @_lang "python3") + (#set! injection.language "python") + (#set! injection.include-children)) @injection.content + +; node/nodejs -> javascript +(recipe_body + (shebang + (language) @_lang) + (#any-of? @_lang "node" "nodejs") + (#set! injection.language "javascript") (#set! injection.include-children)) @injection.content diff --git a/queries/just/textobjects.scm b/queries/just/textobjects.scm index 2894a8b..b010a8e 100644 --- a/queries/just/textobjects.scm +++ b/queries/just/textobjects.scm @@ -2,10 +2,10 @@ ; Specify how to navigate around logical blocks in code -(recipe +(recipe (recipe_body) @function.inner) @function.outer -(parameters +(parameters ((_) @parameter.inner . ","? @parameter.outer)) @parameter.outer (dependency_expression