aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--queries/query/injections.scm18
-rw-r--r--tests/query/injections/query/test-query-injections.scm27
2 files changed, 36 insertions, 9 deletions
diff --git a/queries/query/injections.scm b/queries/query/injections.scm
index c6a74f82f..759f9b2e2 100644
--- a/queries/query/injections.scm
+++ b/queries/query/injections.scm
@@ -1,28 +1,28 @@
((predicate
name: (identifier) @_name
parameters: (parameters
- (string) @injection.content))
+ (string
+ (string_content) @injection.content)))
(#any-of? @_name "match" "not-match" "any-match" "vim-match" "not-vim-match" "any-vim-match")
- (#set! injection.language "regex")
- (#offset! @injection.content 0 1 0 -1))
+ (#set! injection.language "regex"))
((predicate
name: (identifier) @_name
parameters: (parameters
- (string) @injection.content))
+ (string
+ (string_content) @injection.content)))
(#any-of? @_name "lua-match" "not-lua-match" "any-lua-match")
- (#set! injection.language "luap")
- (#offset! @injection.content 0 1 0 -1))
+ (#set! injection.language "luap"))
((predicate
name: (identifier) @_name
parameters: (parameters
- (string) @injection.content
+ (string
+ (string_content) @injection.content)
.
(string) .))
(#any-of? @_name "gsub" "not-gsub")
- (#set! injection.language "luap")
- (#offset! @injection.content 0 1 0 -1))
+ (#set! injection.language "luap"))
((comment) @injection.content
(#set! injection.language "comment"))
diff --git a/tests/query/injections/query/test-query-injections.scm b/tests/query/injections/query/test-query-injections.scm
new file mode 100644
index 000000000..f382eddd9
--- /dev/null
+++ b/tests/query/injections/query/test-query-injections.scm
@@ -0,0 +1,27 @@
+; vim: ft=query
+; format-ignore
+(((symbol) @constant
+ (#not-lua-match? @constant "^_*[A-Z][A-Z0-9_]*$"))
+; ^ @luap
+)
+
+; format-ignore
+(((tag
+ (attributes
+ (attribute
+ (attribute_name) @keyword)))
+ (#match? @keyword "^(:|v-bind|v-|\\@)"))
+; ^ @regex
+)
+
+((comment) @injection.language
+ .
+ [
+ (string_expression
+ (string_fragment) @injection.content)
+ (indented_string_expression
+ (string_fragment) @injection.content)
+ ]
+ (#gsub! @injection.language "#%s*([%w%p]+)%s*" "%1")
+ ; ^ @luap
+ (#set! injection.combined))