Closed Andrew15-5 closed 3 months ago
With Helix, this fixed the problem: https://github.com/helix-editor/helix/pull/10785. But I have no idea what to do in Neovim/tree-sitter if anything can be done.
Instead of https://github.com/uben0/tree-sitter-typst/blob/master/queries/typst/injections.scm#L4-L6, try the following:
(raw_blck
lang: (ident) @_lang
(blob) @injection.content
(#set-lang-from-info-string! @_lang))
It turns out that for Neovim, this exact code is a part of https://github.com/nvim-treesitter/nvim-treesitter. So I did:
diff --git a/queries/typst/injections.scm b/queries/typst/injections.scm
index 344c6a30..bc75d2b2 100644
--- a/queries/typst/injections.scm
+++ b/queries/typst/injections.scm
@@ -2,5 +2,6 @@
(#set! injection.language "comment"))
(raw_blck
- (ident) @injection.language
- (blob) @injection.content)
+ lang: (ident) @_lang
+ (blob) @injection.content
+ (#set-lang-from-info-string! @_lang))
And now it works! I will have to make 2 PRs, I guess.
This doesn't add Python syntax highlighting: