branch: elpa/typst-ts-mode
commit 3fe94be6e1655bccc3d607b3c82d830fcdaef81d
Author: Meow King <[email protected]>
Commit: Meow King <[email protected]>
fix: raw block recognization issue when user turn raw block highlight on
---
typst-ts-edit-indirect.el | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/typst-ts-edit-indirect.el b/typst-ts-edit-indirect.el
index e912946f45..4e340dcd3a 100644
--- a/typst-ts-edit-indirect.el
+++ b/typst-ts-edit-indirect.el
@@ -36,9 +36,13 @@ If there is no fitting mode or no lang it will be
`normal-mode'."
(treesit-node-child-by-field-name
(treesit-node-parent
(with-current-buffer parent-buffer
- (treesit-node-at beg)))
+ (treesit-node-at beg 'typst)))
"lang")))
- (lang (if (string= lang "cpp") "c++" lang))
+ (lang (gethash lang typst-ts-els-tag-lang-map))
+ (lang (when lang ; TODO
+ (if (eq lang 'cpp)
+ "c++"
+ (symbol-name lang))))
(ts-mode (intern-soft
(concat lang "-ts-mode")))
(non-ts-mode (intern-soft
@@ -55,7 +59,7 @@ If there is no fitting mode or no lang it will be
`normal-mode'."
"Edit the block at point with `edit-indirect-region'."
(interactive)
(let* ((block (treesit-parent-until
- (treesit-node-at (point))
+ (treesit-node-at (point) 'typst)
(lambda (node)
(string= (treesit-node-type node) "raw_blck"))
t))