From b531bbf73ef91aca0a699ffc89e6b93dc49d0151 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. --- 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 5110ab890f3..eb5b93008eb 100644 --- a/lisp/progmodes/go-ts-mode.el +++ b/lisp/progmodes/go-ts-mode.el @@ -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 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 +)