[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode c576513 494/495: Fix fontification of multiplicand
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode c576513 494/495: Fix fontification of multiplicand after index expr. |
Date: |
Sat, 7 Aug 2021 09:06:16 -0400 (EDT) |
branch: elpa/go-mode
commit c576513f30cd3308699231d14b25cd3528771d25
Author: Muir Manders <muir@mnd.rs>
Commit: Peter Sanford <psanford@sanford.io>
Fix fontification of multiplicand after index expr.
In "foo[1]*10" we were interpreting "[1]*10" as an array with element
type "*10". At first I was going to fix the identifier regex to
disallow leading numbers (so "10" couldn't be a type name), but that
is involved and doesn't fix the similar case of "foo[1]*foo[2]".
Instead fix the array type detection to disallow an identifier
character preceding the opening bracket.
Fixes #382.
---
go-mode.el | 2 +-
test/go-font-lock-test.el | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/go-mode.el b/go-mode.el
index 17166e6..aa988e5 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -491,7 +491,7 @@ statements."
(go--match-type-alias 2 font-lock-type-face)
;; 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 "\\(?:^\\|[^[:word:][:multibyte:]]\\)\\[\\(?:[[:digit:]]+\\|"
go-qualified-identifier-regexp "\\|" go-identifier-regexp "\\|\\.\\.\\.\\)?\\]"
go-type-name-regexp) 1 font-lock-type-face)
;; Unary "!"
("\\(!\\)[^=]" 1 font-lock-negation-char-face)
diff --git a/test/go-font-lock-test.el b/test/go-font-lock-test.el
index e9aef31..9ca0f4d 100644
--- a/test/go-font-lock-test.el
+++ b/test/go-font-lock-test.el
@@ -126,6 +126,7 @@ a-b: 4,
(go--should-fontify "[123]TfooT")
(go--should-fontify "[...]TfooT")
(go--should-fontify "[foo.Zar]TfooT")
+ (go--should-fontify "D/*DQhi*/Q[1]*TfooT")
(go--should-fontify "KmapK[*Tfoo.ZarT]*Tbar.ZarT")
(go--should-fontify "[]KmapK[TfooT]TbarT")
@@ -202,6 +203,10 @@ KforK {
(go--should-fontify "foo, bar = baz, qux")
(go--should-fontify "KfuncK FfooF(ViV TintT) { VbarV := baz }"))
+(ert-deftest go--fontify-index-multiply ()
+ (go--should-fontify "foo[1]*10 + 1")
+ (go--should-fontify "foo[1]*foo[2] + 1"))
+
(ert-deftest go--fontify-go-dot-mod ()
(go--should-fontify "
KmoduleK foo
- [nongnu] elpa/go-mode fb1272c 441/495: indent: fix performance in giant comments, (continued)
- [nongnu] elpa/go-mode fb1272c 441/495: indent: fix performance in giant comments, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode c020e2c 456/495: Fontify type names in more places., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 2a1584f 454/495: Readme: add note recommending goimports, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 57becfb 460/495: Fontify type names in interface declarations, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode cf53daa 459/495: Fix indentation in naked blocks., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode f872781 466/495: Fontify variable names., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode acec0aa 471/495: Fix Content-Type for https://play.golang.org/share, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode cad6d0a 472/495: Fix fontification performance issue, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 1fbe6a8 490/495: Fix comment filling at start of buffer., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 5186c83 491/495: Support basic indenting in multiline comments., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode c576513 494/495: Fix fontification of multiplicand after index expr.,
ELPA Syncer <=
- [nongnu] elpa/go-mode 49a5380 493/495: Trivial fix of docstring and comment spelling typos., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 584628e 148/495: instead of killing lines, delete them, to avoid manipulating the kill ring, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode a82c165 221/495: fix the license, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 27068bb 222/495: provide configuration option for how to display coverage buffer, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 86ed568 235/495: add link to `defgroup'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode a9b9871 247/495: Use view-mode in godoc-mode, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode dce210f 250/495: Bump version to 1.3.1, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 8baa836 251/495: Don't break fontification when limiting point, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode dccb56c 256/495: go-unused-imports-lines: only compile the current file, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode d91a157 257/495: Add goto functions for working with function signatures, ELPA Syncer, 2021/08/07