aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/scala
diff options
context:
space:
mode:
authorJaakko Paju2024-01-28 09:12:07 +0000
committerGitHub2024-01-28 09:12:07 +0000
commit9978d421fe7237c74932c34263d91445728d65d1 (patch)
tree3311e2efde6b7619a42ae9f690ca686ffb32442d /runtime/queries/scala
parentf0be0c6d4a6c253e258b977436144796b8bd086f (diff)
Include interpolated SQL strings in Scala injection queries (#9428)
* Change Scala injection queries to include SQL strings * Include block comments in comment injection * Change #match predicate to #any-of Co-authored-by: Kirawi <67773714+kirawi@users.noreply.github.com> --------- Co-authored-by: Kirawi <67773714+kirawi@users.noreply.github.com>
Diffstat (limited to 'runtime/queries/scala')
-rw-r--r--runtime/queries/scala/injections.scm16
1 files changed, 15 insertions, 1 deletions
diff --git a/runtime/queries/scala/injections.scm b/runtime/queries/scala/injections.scm
index 321c90ad..1ad68557 100644
--- a/runtime/queries/scala/injections.scm
+++ b/runtime/queries/scala/injections.scm
@@ -1,2 +1,16 @@
-((comment) @injection.content
+([(comment) (block_comment)] @injection.content
(#set! injection.language "comment"))
+
+
+; TODO for some reason multiline string (triple quotes) interpolation works only if it contains interpolated value
+; Matches these SQL interpolators:
+; - Doobie: 'sql', 'fr'
+; - Quill: 'sql', 'infix'
+; - Slick: 'sql', 'sqlu'
+(interpolated_string_expression
+ interpolator:
+ ((identifier) @interpolator
+ (#any-of? @interpolator "fr" "infix" "sql" "sqlu"))
+ (interpolated_string) @injection.content
+ (#set! injection.language "sql"))
+