From e70f8833e2ba4903324449da7f2116b75de67537 Mon Sep 17 00:00:00 2001 From: uncenter <47499684+uncenter@users.noreply.github.com> Date: Sat, 1 Feb 2025 19:18:08 -0500 Subject: [PATCH] Highlight $ template literals as shell commands (#12751) --- runtime/queries/ecma/injections.scm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/runtime/queries/ecma/injections.scm b/runtime/queries/ecma/injections.scm index 09cca4418..72ad31da4 100644 --- a/runtime/queries/ecma/injections.scm +++ b/runtime/queries/ecma/injections.scm @@ -10,6 +10,18 @@ arguments: (template_string) @injection.content (#any-of? @injection.language "html" "css" "json" "sql" "js" "ts" "bash")) +; Parse the contents of $ template literals as shell commands + +(call_expression + function: [ + (identifier) @_template_function_name + (member_expression + property: (property_identifier) @_template_function_name) + ] + arguments: (template_string) @injection.content + (#eq? @_template_function_name "$") + (#set! injection.language "bash")) + ; Parse the contents of gql template literals ((call_expression