Skip to content

Commit

Permalink
feat: rust and norg injections
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbuhr committed Mar 2, 2024
1 parent b52207c commit 66c5fbb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
11 changes: 11 additions & 0 deletions after/queries/norg/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
; Injection for code blocks
(ranged_verbatim_tag (tag_name) @_tagname (tag_parameters .(tag_param) @injection.language) (ranged_verbatim_tag_content) @injection.content (#any-of? @_tagname "code" "embed"))
(ranged_verbatim_tag (tag_name) @_tagname (tag_parameters)? (ranged_verbatim_tag_content) @injection.content (#eq? @_tagname "math") (#set! injection.language "latex"))

(
(inline_math) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.language "latex")
)

(ranged_verbatim_tag (tag_name) @_tagname (ranged_verbatim_tag_content) @injection.content (#eq? @_tagname "document.meta") (#set! injection.language "norg_meta"))
14 changes: 14 additions & 0 deletions after/queries/rust/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
;extends
(macro_invocation
(scoped_identifier
path: (identifier) @path (#eq? @path "sqlx")
name: (identifier) @name (#match? @name "^query.*")
)

(token_tree
(raw_string_literal) @injection.content
(#set! injection.language "sql")
(#set! injection.include-children)
)
(#offset! @injection.content 0 3 0 -2)
)

0 comments on commit 66c5fbb

Please sign in to comment.