]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix go-ts-mode const_spec highlighting (Bug#76330)
authorRandy Taylor <dev@rjt.dev>
Sun, 16 Feb 2025 20:51:43 +0000 (15:51 -0500)
committerEshel Yaron <me@eshelyaron.com>
Tue, 4 Mar 2025 20:57:14 +0000 (21:57 +0100)
* 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
test/lisp/progmodes/go-ts-mode-resources/font-lock.go

index 0d1265309e8d30b4925c0d805c0cb6dc99ab28d0..86d98d90d3e74b6d223fffce761c5bdfa62faa28 100644 (file)
      ,@(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
index 4e7a8e1710ba1785e656784fcfe5b49bcc67d0ba..170bf9353c65c4697c4c4af8fe4cc69565d031dd 100644 (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
+)