[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode 4fabba6 464/495: Small fix for fontification of ar
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode 4fabba6 464/495: Small fix for fontification of array types |
Date: |
Sat, 7 Aug 2021 09:06:10 -0400 (EDT) |
branch: elpa/go-mode
commit 4fabba6e20d2da78644087a19a23361cb3b7d20d
Author: Muir Manders <muir@mnd.rs>
Commit: Peter Sanford <psanford@sanford.io>
Small fix for fontification of array types
We weren't fontifying the type for array types like "[someConst]int". We now
allow identifiers in the brackets.
I also dropped the must-be-preceded-by-non-word case since I don't think it
is
necessary and it prevents fontification at the beginning of the line.
Closes: #311 [via git-merge-pr]
---
go-mode.el | 5 ++++-
test/go-font-lock-test.el | 13 +++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/go-mode.el b/go-mode.el
index 6b55003..ae9cdb9 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -446,7 +446,10 @@ For mode=set, all covered lines will have this weight."
("\\(`[^`]*`\\)" 1 font-lock-multiline) ;; raw string literal, needed for
font-lock-syntactic-keywords
(,(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
+
+ ;; Arrays/slices: []<type> | [123]<type> | [some.Const]<type> |
[someConst]<type> | [...]<type>
+ (,(concat "\\[\\(?:[[:digit:]]+\\|" go-qualified-identifier-regexp "\\|"
go-identifier-regexp "\\|\\.\\.\\.\\)?\\]" go-type-name-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
diff --git a/test/go-font-lock-test.el b/test/go-font-lock-test.el
index d5f94fe..6a20e77 100644
--- a/test/go-font-lock-test.el
+++ b/test/go-font-lock-test.el
@@ -84,6 +84,19 @@ KcaseK string:
(should-fontify "Tfoo.ZarT{")
(should-fontify "[]Tfoo.ZarT{"))
+(ert-deftest go--fontify-slices-arrays-maps ()
+ (should-fontify "[]TfooT")
+ (should-fontify "[]Tfoo.ZarT")
+ (should-fontify "[]*Tfoo.ZarT")
+
+ (should-fontify "[123]TfooT")
+ (should-fontify "[...]TfooT")
+ (should-fontify "[foo.Zar]TfooT")
+
+ (should-fontify "KmapK[*Tfoo.ZarT]*Tbar.ZarT")
+ (should-fontify "[]KmapK[TfooT]TbarT")
+ (should-fontify "KmapK[[1][2][three]*Tfoo.ZarT][four][]*Tbar.ZarT"))
+
(defun should-fontify (contents)
"Verify fontification.
- [nongnu] elpa/go-mode d387378 438/495: indent: handle comments after multiline case lists, (continued)
- [nongnu] elpa/go-mode d387378 438/495: indent: handle comments after multiline case lists, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode fbf2544 444/495: Improve fill-paragraph for comment blocks., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode e7e0157 447/495: indent: fix indent at top level of file, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 3bc7479 450/495: Fix infinite loop in fill-region, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 88ffc9e 452/495: Add github action yaml file to run ert tests, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 4f15abf 449/495: Fix fill-paragraph for certain block comments., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode a13b814 448/495: Add option to reuse a single buffer for godoc, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode a82369b 453/495: Readme: add basic information about gopls., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 839190b 455/495: Run all tests in GH CI, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 7248358 462/495: Fontify type names in type switch statements, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 4fabba6 464/495: Small fix for fontification of array types,
ELPA Syncer <=
- [nongnu] elpa/go-mode 656590a 463/495: Fontify qualified composite literal types., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode d304565 474/495: Fix signature fontification after comments., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode e9b9c0e 473/495: Add some fontification faces for go-dot-mod-mode., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 4acf733 468/495: Fully fontify type and const decls., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode dac200f 469/495: Fix font locking in nested signatures., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode fa2162b 475/495: Fix "nil" fontification in type switch clause., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 7ce031c 481/495: Allow disabling variable font locking., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode e10d677 478/495: indent: fix func literals in dangling lines, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode c9f5e92 483/495: Fix indentation of chained dangling selectors., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode fdf46fe 492/495: Fix go.mod fontification., ELPA Syncer, 2021/08/07