Fix go-ts-mode const_spec highlighting (Bug#76330)

* lisp/progmodes/go-ts-mode.el (go-ts-mode--font-lock-settings):
Handle multiple const_spec identifiers.
* test/lisp/progmodes/go-ts-mode-resources/font-lock.go:
Add test case.
This commit is contained in:
Randy Taylor 2025-02-16 15:51:43 -05:00 committed by Eli Zaretskii
parent bd1d6761f4
commit b531bbf73e
2 changed files with 8 additions and 1 deletions

View file

@ -154,7 +154,8 @@
,@(when (go-ts-mode--iota-query-supported-p)
'((iota) @font-lock-constant-face))
(const_declaration
(const_spec name: (identifier) @font-lock-constant-face)))
(const_spec name: (identifier) @font-lock-constant-face
("," name: (identifier) @font-lock-constant-face)*)))
:language 'go
:feature 'delimiter

View file

@ -3,3 +3,9 @@ for idx, val := range arr {}
// ^ font-lock-variable-name-face
for idx := 0; idx < n; idx++ {}
// ^ font-lock-variable-name-face
const (
zero, one = 0, 1
// ^ font-lock-constant-face
// ^ font-lock-constant-face
)