bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#60251: 29.0.60; Consider the language at point for tree sitter trees


From: Stefan Kangas
Subject: bug#60251: 29.0.60; Consider the language at point for tree sitter treesit-inspect-node-at-point
Date: Tue, 5 Sep 2023 16:32:12 -0700

Wilhelm H Kirschbaum <wilhelm@floatpays.co.za> writes:

> The following change will make it possible to inspect a node when using
> an embedded language, otherwise it will assume the first specified
> language without allowing specifying the language. This assumes that
> treesit-language-at-point-function has been correctly set. diff --git

Yuan, do you have any comments on the below patch?  Thanks in advance.

> a/lisp/treesit.el b/lisp/treesit.el
> index 6407669118..74dfd26776 100644
> --- a/lisp/treesit.el
> +++ b/lisp/treesit.el
> @@ -1931,7 +1931,7 @@ treesit-inspect-node-at-point
>   (interactive "p")
>   ;; NODE-LIST contains all the node that starts at point.
>   (let* ((node-list
> -          (cl-loop for node = (treesit-node-at (point))
> +          (cl-loop for node = (treesit-node-at (point) (treesit-language-at
> (point)))
>                    then (treesit-node-parent node)
>                    while node
>                    if (eq (treesit-node-start node)
>
>
> Another option might be to allow parser-or-lang as an argument, but
> thinking that as an interactive function for debugging the above might
> be more useful, but either way it does not seem possible to
> inspect-node-at-point for multiple language configuration.
>
> Regards,
> Wilhelm





reply via email to

[Prev in Thread] Current Thread [Next in Thread]