GNU bug report logs -
#75609
Hideshow support for treesitter
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Thu, 16 Jan 2025 17:50:01 UTC
Severity: wishlist
Tags: patch
Fixed in version 31.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
Message #19 received at 75609 <at> debbugs.gnu.org (full text, mbox):
> Cc: 75609 <at> debbugs.gnu.org
> From: Juri Linkov <juri <at> linkov.net>
> Date: Thu, 23 Jan 2025 09:34:34 +0200
>
> +(defun treesit-forward-comment (&optional count)
> + "Tree-sitter `forward-comment-function' implementation.
> +
> +COUNT is the same as in `forward-comment'."
> + (let ((res t) thing)
> + (while (> count 0)
> + (skip-syntax-forward " >")
> + (setq thing (treesit-thing-at (point) 'comment))
> + (if (and thing (eq (point) (treesit-node-start thing)))
> + (progn
> + (goto-char (min (1+ (treesit-node-end thing)) (point-max)))
> + (setq count (1- count)))
> + (setq count 0 res nil)))
> + (while (< count 0)
> + (skip-syntax-backward " >")
> + (setq thing (treesit-thing-at (max (1- (point)) (point-min)) 'comment))
> + (if (and thing (eq (point) (treesit-node-end thing)))
> + (progn
> + (goto-char (treesit-node-start thing))
> + (setq count (1+ count)))
> + (setq count 0 res nil)))
> + res))
I'm curious: why do you have to use skip-syntax-forward/backward when
tree-sitter already should know where a comment starts and ends?
ideally, features that use tree-sitter should not need to consult any
syntax tables set up by the major mode. Or what am I missing?
This bug report was last modified 164 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.