-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
py
does not trigger nested Python tree-sitter to work, but python
does
#34
Comments
With Helix, this fixed the problem: helix-editor/helix#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, (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:
But this does:
While both work fine with Markdown tree-sitter.
Checked on Neovim and Helix.
The text was updated successfully, but these errors were encountered: