Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions crates/languages/src/javascript/injections.scm
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,36 @@
(#match? @_ecma_comment "^\\/\\*\\s*(css)\\s*\\*\\/")
(#set! injection.language "css")
)

; ArkType function calls - highlight string/template arguments as TypeScript
(call_expression
function: (identifier) @_name
(#match? @_name "^(type|generic|scope|define|match|fn|module|[aA]rk[a-zA-Z]*)$")
arguments: (arguments [
(string (string_fragment) @injection.content)
(template_string (string_fragment) @injection.content)
])
(#set! injection.language "typescript")
)

; ArkType chained method calls
(call_expression
function: (member_expression
property: (property_identifier) @_method
(#match? @_method "^(and|or|case|in|extends|ifExtends|intersect|merge|exclude|extract|overlaps|subsumes|to|satisfies)$"))
arguments: (arguments [
(string (string_fragment) @injection.content)
(template_string (string_fragment) @injection.content)
])
(#set! injection.language "typescript")
)

; ArkType regex function - highlight as regex
(call_expression
function: (identifier) @_name (#eq? @_name "regex")
arguments: (arguments [
(string (string_fragment) @injection.content)
(template_string (string_fragment) @injection.content)
])
(#set! injection.language "regex")
)
33 changes: 33 additions & 0 deletions crates/languages/src/typescript/injections.scm
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,36 @@
(#match? @_ecma_comment "^\\/\\*\\s*(css)\\s*\\*\\/")
(#set! injection.language "css")
)

; ArkType function calls - highlight string/template arguments as TypeScript
(call_expression
function: (identifier) @_name
(#match? @_name "^(type|generic|scope|define|match|fn|module|[aA]rk[a-zA-Z]*)$")
arguments: (arguments [
(string (string_fragment) @injection.content)
(template_string (string_fragment) @injection.content)
])
(#set! injection.language "typescript")
)

; ArkType chained method calls
(call_expression
function: (member_expression
property: (property_identifier) @_method
(#match? @_method "^(and|or|case|in|extends|ifExtends|intersect|merge|exclude|extract|overlaps|subsumes|to|satisfies)$"))
arguments: (arguments [
(string (string_fragment) @injection.content)
(template_string (string_fragment) @injection.content)
])
(#set! injection.language "typescript")
)

; ArkType regex function - highlight as regex
(call_expression
function: (identifier) @_name (#eq? @_name "regex")
arguments: (arguments [
(string (string_fragment) @injection.content)
(template_string (string_fragment) @injection.content)
])
(#set! injection.language "regex")
)