[Top][All Lists]

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

Re: Help with tree-sitter imenu settings.

From: Aleksandr Vityazev
Subject: Re: Help with tree-sitter imenu settings.
Date: Thu, 14 Dec 2023 14:03:12 +0300
User-agent: Gnus/5.13 (Gnus v5.13)

I found a solution:

#+begin_src elisp
  (defun devicetree-ts-mode--node-address (node)
  "Return unit addresses for NODE concanated with @."
  (mapconcat (lambda (children)
               (if (string-equal (treesit-node-field-name children)
                   (treesit-node-text children t)
             (treesit-node-children node)

(defun devicetree-ts--mode--name-function (node)
  "Return name of NODE to use for in imenu."
  (let ((name (treesit-node-child-by-field-name node "name")))
    (concat (treesit-node-text name t)
            (devicetree-ts-mode--node-address node))))

Best regards,
Aleksandr Vityazev

Attachment: signature.asc
Description: PGP signature

reply via email to

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