[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode bd2f6d2 467/495: Fix multiline func signature font
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode bd2f6d2 467/495: Fix multiline func signature fontification. |
Date: |
Sat, 7 Aug 2021 09:06:10 -0400 (EDT) |
branch: elpa/go-mode
commit bd2f6d21196da95447c330cca7d35fb0a6798b4a
Author: Muir Manders <muir@mnd.rs>
Commit: Peter Sanford <psanford@sanford.io>
Fix multiline func signature fontification.
Now that we use the proper anchor mechanism, we can just have the
"pre" form return the position of the closing param list ")", and set
font-lock-multiline, and basically that is it.
I thought I was going to have to add something to
font-lock-extend-region-functions, but that didn't seem necessary. If
there are further cases of missing fontification we can try adding the
region extending function for param lists.
Closes: #315 [via git-merge-pr]
---
go-mode.el | 21 ++++++++++++++-------
test/go-font-lock-test.el | 11 ++++++++++-
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/go-mode.el b/go-mode.el
index 6ac749a..0722769 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -1278,7 +1278,15 @@ func foo(i, j int) {}
"
(setq go--fontify-param-has-name (eq
(go--parameter-list-type (point-max))
- 'present)))
+ 'present))
+ ;; Return position of closing paren so we process the entire
+ ;; multiline param list.
+ (save-excursion
+ (let ((depth (go-paren-level)))
+ (while (and
+ (re-search-forward ")" nil t)
+ (> (go-paren-level) depth))))
+ (point)))
(defun go--match-param-start (end)
"Search for the starting of param lists.
@@ -1352,12 +1360,11 @@ the next comma or to the closing paren."
(defun go--search-next-comma (end)
"Search forward from point for a comma whose nesting level is
-the same as point. If it reaches the end of line or a closing
-parenthesis before a comma, it stops at it. Return non-nil if
-comma was found."
+the same as point. If it reaches a closing parenthesis before a
+comma, it stops at it. Return non-nil if comma was found."
(let ((orig-level (go-paren-level)))
(while (and (< (point) end)
- (or (looking-at-p "[^,)\n]")
+ (or (looking-at-p "[^,)]")
(> (go-paren-level) orig-level)))
(forward-char))
(when (and (looking-at-p ",")
@@ -1575,8 +1582,8 @@ with goflymake \(see URL
`https://github.com/dougm/goflymake'), gocode
\(see URL `https://github.com/dominikh/yasnippet-go')"
;; Font lock
- (set (make-local-variable 'font-lock-defaults)
- '(go--build-font-lock-keywords))
+ (setq font-lock-defaults '(go--build-font-lock-keywords))
+ (setq font-lock-multiline t)
;; Indentation
(set (make-local-variable 'indent-line-function) #'go-mode-indent-line)
diff --git a/test/go-font-lock-test.el b/test/go-font-lock-test.el
index 06845bc..bbe62cf 100644
--- a/test/go-font-lock-test.el
+++ b/test/go-font-lock-test.el
@@ -25,7 +25,16 @@
(should-fontify "KfuncK(VaV ...TintT) { }")
(should-fontify "KfuncK(VaV ...KinterfaceK{}) { }")
- (should-fontify "KfuncK(KinterfaceK { FfooF() }, TstringT) KinterfaceK{}"))
+ (should-fontify "KfuncK(KinterfaceK { FfooF() }, TstringT) KinterfaceK{}")
+
+ (should-fontify "
+KfuncK FfooF(
+ VaV TcatT, VbV KinterfaceK { FbarkF() },
+ VcV TbananaT,
+) (
+ VwhyV TdothisT,
+ VjustV TstopT,
+) { }"))
(ert-deftest go--fontify-decls ()
(should-fontify "KvarK VfooV TintT")
- [nongnu] elpa/go-mode da55ef1 413/495: Evaluate error conditions before prompting for new name, (continued)
- [nongnu] elpa/go-mode da55ef1 413/495: Evaluate error conditions before prompting for new name, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 59dfa96 423/495: Add confirmation prompt for Playground uploads, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 13e9f22 428/495: Fix go-rename when buffer is not visiting any file, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 9ab06b3 443/495: indent: fix nested dangling lines that don't use parens, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 6d58e9d 442/495: indent: fix case statement in func in composite literal, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 592bd4b 440/495: indent: fix various cases with dangling operators, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 35a5ddc 445/495: indent: fix decl statements with dangling "=", ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode f9174b2 458/495: Improve go-dot-mod-mode font lock regexp, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 91b37c4 461/495: Disable output during indentation tests, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode d712cf3 470/495: Make yes-or-no-p's PROMPT end in a space, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode bd2f6d2 467/495: Fix multiline func signature fontification.,
ELPA Syncer <=
- [nongnu] elpa/go-mode b91a6cd 479/495: Fix composite literal key fontification, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 85a20da 482/495: Only fontify ident keys in composite literals, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 53c76cd 480/495: Speed up slow fontification after unclosed parens., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 8bfc70a 484/495: Fix accidental old style backquote comma use., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode d17d210 489/495: Improve go-fontify-variables logic., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 3497434 495/495: Fix fontification of chained map types., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 8d1594f 295/495: Automatically detect goimports, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 734d523 488/495: Move some defconsts up to fix compiler warnings., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 51f507c 315/495: Complete list of commands in mode docstring, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 004575e 330/495: Don't leave godef buffer around, ELPA Syncer, 2021/08/07