1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00

Improve dockerfile-ts-mode imenu generation (Bug#59979)

* lisp/progmodes/dockerfile-ts-mode.el (treesit-node-child-by-field-name):
Declare.
(dockerfile-ts-mode--imenu-1): Use stage name if available.
This commit is contained in:
Randy Taylor 2022-12-11 20:50:54 -05:00 committed by Yuan Fu
parent 631908f701
commit c0fe6c72ce
No known key found for this signature in database
GPG Key ID: 56E19BC57664A442

View File

@ -33,6 +33,7 @@
(declare-function treesit-parser-create "treesit.c")
(declare-function treesit-induce-sparse-tree "treesit.c")
(declare-function treesit-node-child "treesit.c")
(declare-function treesit-node-child-by-field-name "treesit.c")
(declare-function treesit-node-start "treesit.c")
(declare-function treesit-node-type "treesit.c")
@ -117,8 +118,10 @@ the subtrees."
children))
(name (when ts-node
(pcase (treesit-node-type ts-node)
("from_instruction" (treesit-node-text
(treesit-node-child ts-node 1) t)))))
("from_instruction"
(treesit-node-text
(or (treesit-node-child-by-field-name ts-node "as")
(treesit-node-child ts-node 1)) t)))))
(marker (when ts-node
(set-marker (make-marker)
(treesit-node-start ts-node)))))