From d4fd797661bbdc728f8a68fdab44282fd4dc7b5a Mon Sep 17 00:00:00 2001 From: Randy Taylor Date: Sun, 16 Feb 2025 15:51:43 -0500 Subject: [PATCH] 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. (cherry picked from commit b531bbf73ef91aca0a699ffc89e6b93dc49d0151) --- lisp/progmodes/go-ts-mode.el | 3 ++- test/lisp/progmodes/go-ts-mode-resources/font-lock.go | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el index 0d1265309e8..86d98d90d3e 100644 --- a/lisp/progmodes/go-ts-mode.el +++ b/lisp/progmodes/go-ts-mode.el @@ -172,7 +172,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 diff --git a/test/lisp/progmodes/go-ts-mode-resources/font-lock.go b/test/lisp/progmodes/go-ts-mode-resources/font-lock.go index 4e7a8e1710b..170bf9353c6 100644 --- a/test/lisp/progmodes/go-ts-mode-resources/font-lock.go +++ b/test/lisp/progmodes/go-ts-mode-resources/font-lock.go @@ -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 +) -- 2.39.5