emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/go-mode 8c13a82 240/495: match identifiers, not type names


From: ELPA Syncer
Subject: [nongnu] elpa/go-mode 8c13a82 240/495: match identifiers, not type names, when highlighting struct literal
Date: Sat, 7 Aug 2021 09:05:23 -0400 (EDT)

branch: elpa/go-mode
commit 8c13a82db21607078b01b89f45b88ffc9527ca92
Author: Dominik Honnef <dominik@honnef.co>
Commit: Dominik Honnef <dominik@honnef.co>

    match identifiers, not type names, when highlighting struct literal
    
    In code like `foo(&T{})`, we want to highlight T. We only want to
    highlight struct literals, which can only be T or &T. Commit
    3fb128afb93780e1b768b552137c950074e78129 changed this fontification rule
    to match type names instead of identifiers. The difference is, that type
    names may be prefixed with an asterisk or opening parenthesis, which
    would lead to matching the opening parenthesis in the function call.
    Revert this change.
---
 go-mode.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/go-mode.el b/go-mode.el
index 7e262ba..fca4937 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -344,7 +344,7 @@ For mode=set, all covered lines will have this weight."
      (,(concat (go--regexp-enclose-in-symbol "type") 
"[[:space:]]+\\([^[:space:]]+\\)") 1 font-lock-type-face) ;; types
      (,(concat (go--regexp-enclose-in-symbol "type") "[[:space:]]+" 
go-identifier-regexp "[[:space:]]*" go-type-name-regexp) 1 font-lock-type-face) 
;; types
      (,(concat "[^[:word:][:multibyte:]]\\[\\([[:digit:]]+\\|\\.\\.\\.\\)?\\]" 
go-type-name-regexp) 2 font-lock-type-face) ;; Arrays/slices
-     (,(concat "\\(" go-type-name-regexp "\\)" "{") 1 font-lock-type-face)
+     (,(concat "\\(" go-identifier-regexp "\\)" "{") 1 font-lock-type-face)
      (,(concat (go--regexp-enclose-in-symbol "map") "\\[[^]]+\\]" 
go-type-name-regexp) 1 font-lock-type-face) ;; map value type
      (,(concat (go--regexp-enclose-in-symbol "map") "\\[" go-type-name-regexp) 
1 font-lock-type-face) ;; map key type
      (,(concat (go--regexp-enclose-in-symbol "chan") 
"[[:space:]]*\\(?:<-[[:space:]]*\\)?" go-type-name-regexp) 1 
font-lock-type-face) ;; channel type



reply via email to

[Prev in Thread] Current Thread [Next in Thread]