1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 10:31:37 -08:00

Minor change to tree-sitter imenu function of js-mode

If someone don’t like the labels, they can set them to empty strings.

* lisp/progmodes/js.el (js--treesit-imenu-type-alist): Add space.
(js--treesit-imenu-label): Remove space.
This commit is contained in:
Yuan Fu 2022-11-03 11:44:35 -07:00
parent 5416ae5990
commit f9f9b43df5
No known key found for this signature in database
GPG key ID: 56E19BC57664A442

View file

@ -3620,10 +3620,10 @@ This function can be used as a value in `which-func-functions'"
;; Keep this private since we might later change it or generalize it.
(defvar js--treesit-imenu-type-alist
'((variable . "V")
(function . "F")
(class . "C")
(method . "M"))
'((variable . "V ")
(function . "F ")
(class . "C ")
(method . "M "))
"Maps imenu label types to their \"symbol\".
Symbols are prefixed to each label in imenu (see
`js--treesit-imenu-label').")
@ -3632,7 +3632,7 @@ Symbols are prefixed to each label in imenu (see
"Format label for imenu.
TYPE can be `variable', `function', `class', `method'.
NAME is a string."
(format "%s %s" (alist-get type js--treesit-imenu-type-alist)
(format "%s%s" (alist-get type js--treesit-imenu-type-alist)
name))
(defun js--treesit-imenu-1 (node)