branch: elpa/typst-ts-mode commit d88d8feeee587ee9b58a0e334d1a9704a6159d69 Author: Huan Nguyen <nguyenthieuh...@gmail.com> Commit: Huan Nguyen <nguyenthieuh...@gmail.com>
fix: #15 - #[ text ] |< M-Enter Auto inserting not working yet --- typst-ts-editing.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/typst-ts-editing.el b/typst-ts-editing.el index 8f15490ffd..1cb3c75884 100644 --- a/typst-ts-editing.el +++ b/typst-ts-editing.el @@ -92,10 +92,13 @@ the `GLOBAL-MAP' (example: `right-word')." The new heading is created after the ending of current heading. Using ARG argument will ignore the context and it will insert a heading instead." (interactive "P") - (let ((node (typst-ts-core-get-parent-of-node-at-bol-nonwhite))) + (let ((node (treesit-parent-until + (treesit-node-at (line-beginning-position)) + (lambda (node) + (string= "item" (treesit-node-type node)))))) (cond (arg (typst-ts-mode-insert--heading nil)) - ((string= (treesit-node-type node) "item") + (node (typst-ts-mode-insert--item node)) (t (typst-ts-mode-insert--heading node)))))