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

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

[nongnu] elpa/go-mode 656590a 463/495: Fontify qualified composite liter


From: ELPA Syncer
Subject: [nongnu] elpa/go-mode 656590a 463/495: Fontify qualified composite literal types.
Date: Sat, 7 Aug 2021 09:06:09 -0400 (EDT)

branch: elpa/go-mode
commit 656590a695b2fcb1a0c398ce7c3317984edbb0c8
Author: Muir Manders <muir@mnd.rs>
Commit: Peter Sanford <psanford@sanford.io>

    Fontify qualified composite literal types.
    
    In "foo.Bar{}" we now fontify all of "foo.Bar" instead of just "Bar". This 
is
    consistent with how we fontify types in other places.
---
 go-mode.el                | 5 ++---
 test/go-font-lock-test.el | 5 +++++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/go-mode.el b/go-mode.el
index a58c091..6b55003 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -447,13 +447,12 @@ For mode=set, all covered lines will have this weight."
      (,(concat "\\_<type\\_>[[:space:]]+\\([^[:space:](]+\\)") 1 
font-lock-type-face) ;; types
      (,(concat "\\_<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-identifier-regexp "\\)" "{") 1 font-lock-type-face)
+     (,(concat go-type-name-regexp "{") 1 font-lock-type-face)
      (,(concat "\\_<map\\_>\\[[^]]+\\]" go-type-name-regexp) 1 
font-lock-type-face) ;; map value type
      (,(concat "\\_<map\\_>\\[" go-type-name-regexp) 1 font-lock-type-face) ;; 
map key type
      (,(concat "\\_<chan\\_>[[:space:]]*\\(?:<-[[:space:]]*\\)?" 
go-type-name-regexp) 1 font-lock-type-face) ;; channel type
      (,(concat "\\_<\\(?:new\\|make\\)\\_>\\(?:[[:space:]]\\|)\\)*(" 
go-type-name-regexp) 1 font-lock-type-face) ;; new/make type
-     ;; TODO do we actually need this one or isn't it just a function call?
-     (,(concat "\\.\\s *(" go-type-name-regexp) 1 font-lock-type-face) ;; Type 
conversion
+     (,(concat "\\.\\s *(" go-type-name-regexp) 1 font-lock-type-face) ;; Type 
assertion
      ;; Like the original go-mode this also marks compound literal
      ;; fields. There, it was marked as to fix, but I grew quite
      ;; accustomed to it, so it'll stay for now.
diff --git a/test/go-font-lock-test.el b/test/go-font-lock-test.el
index ecbba92..d5f94fe 100644
--- a/test/go-font-lock-test.el
+++ b/test/go-font-lock-test.el
@@ -78,6 +78,11 @@ KswitchK 123 {
 KcaseK string:
 }"))
 
+(ert-deftest go--fontify-composite-literal ()
+  (should-fontify "TfooT{")
+  (should-fontify "[]TfooT{")
+  (should-fontify "Tfoo.ZarT{")
+  (should-fontify "[]Tfoo.ZarT{"))
 
 (defun should-fontify (contents)
   "Verify fontification.



reply via email to

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