From f3858d5738095af6a8bdc0b11037d2d8d5a5bd09 Mon Sep 17 00:00:00 2001 From: uncenter <47499684+uncenter@users.noreply.github.com> Date: Sun, 8 Dec 2024 11:18:42 -0500 Subject: [PATCH 1/3] Restrict tagged template language injections for ecma --- runtime/queries/ecma/injections.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtime/queries/ecma/injections.scm b/runtime/queries/ecma/injections.scm index af3aef10510e..37e9fb478fd1 100644 --- a/runtime/queries/ecma/injections.scm +++ b/runtime/queries/ecma/injections.scm @@ -7,7 +7,8 @@ (member_expression property: (property_identifier) @injection.language) ] - arguments: (template_string) @injection.content) + arguments: (template_string) @injection.content + (#match? @injection.language "^(html|css)$")) ; Parse the contents of gql template literals From 86796756376ed7fa544ee0014948d7430178c0f2 Mon Sep 17 00:00:00 2001 From: uncenter <47499684+uncenter@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:30:45 -0500 Subject: [PATCH 2/3] Add JSON, SQL, JS, TS, and Bash to allow list --- runtime/queries/ecma/injections.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/queries/ecma/injections.scm b/runtime/queries/ecma/injections.scm index 37e9fb478fd1..bee687812379 100644 --- a/runtime/queries/ecma/injections.scm +++ b/runtime/queries/ecma/injections.scm @@ -8,7 +8,7 @@ property: (property_identifier) @injection.language) ] arguments: (template_string) @injection.content - (#match? @injection.language "^(html|css)$")) + (#match? @injection.language "^(html|css|json|sql|js|ts|bash)$")) ; Parse the contents of gql template literals From a49ec360924e1b4c80a83f32c504b0054a4dbd0f Mon Sep 17 00:00:00 2001 From: uncenter <47499684+uncenter@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:33:07 -0500 Subject: [PATCH 3/3] Use any-of instead of match --- runtime/queries/ecma/injections.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/queries/ecma/injections.scm b/runtime/queries/ecma/injections.scm index bee687812379..09cca4418bd4 100644 --- a/runtime/queries/ecma/injections.scm +++ b/runtime/queries/ecma/injections.scm @@ -8,7 +8,7 @@ property: (property_identifier) @injection.language) ] arguments: (template_string) @injection.content - (#match? @injection.language "^(html|css|json|sql|js|ts|bash)$")) + (#any-of? @injection.language "html" "css" "json" "sql" "js" "ts" "bash")) ; Parse the contents of gql template literals