[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode cad6d0a 472/495: Fix fontification performance iss
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode cad6d0a 472/495: Fix fontification performance issue |
Date: |
Sat, 7 Aug 2021 09:06:11 -0400 (EDT) |
branch: elpa/go-mode
commit cad6d0a522f8f5c351a1332bcd54bd5ffd8ce30d
Author: Muir Manders <muir@mnd.rs>
Commit: Peter Sanford <psanford@sanford.io>
Fix fontification performance issue
When looking for the start of a param list, don't match "(" in
comments/strings. This was causing us to do a lot of extra work when
the comment was at the file scope.
What I think was happening was we would expand our multiline keyword
scope to the end of the buffer looking for the corresponding closing
")". This caused us to font lock much bigger parts of the buffer where
normally you only font lock a line or two at a time.
I also killed some dead code I noticed in go--match-decl.
Closes: #322 [via git-merge-pr]
---
go-mode.el | 37 +++++++++++++++----------------------
1 file changed, 15 insertions(+), 22 deletions(-)
diff --git a/go-mode.el b/go-mode.el
index 58a6196..b5e4c44 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -1321,7 +1321,8 @@ declarations are also included."
(let (found-match)
(while (and
(not found-match)
- (re-search-forward (concat "\\(\\_<" go-identifier-regexp "\\)?(")
end t))
+ (re-search-forward (concat "\\(\\_<" go-identifier-regexp "\\)?(")
end t)
+ (not (go-in-string-or-comment-p)))
(save-excursion
(goto-char (match-beginning 0))
@@ -1473,27 +1474,19 @@ gets highlighted by the font lock keyword."
;; We aren't on right side of equals sign.
(not (go--looking-back-p "=")))
- (or
- ;; We are followed directly by comma.
- (looking-at-p "[[:space:]]*,")
-
- ;; Or we are followed by a space and non-space (non-space
- ;; might be a type name or "=").
- (looking-at-p "[[:space:]]+[^[:space:]]"))
-
- (setq found-match t)
-
- ;; Unset match data subexpressions that don't apply based on
- ;; the decl kind.
- (let ((md (match-data)))
- (cond
- ((string= decl "var")
- (setf (nth 4 md) nil (nth 5 md) nil (nth 6 md) nil (nth 7 md)
nil))
- ((string= decl "const")
- (setf (nth 2 md) nil (nth 3 md) nil (nth 6 md) nil (nth 7 md)
nil))
- ((string= decl "type")
- (setf (nth 2 md) nil (nth 3 md) nil (nth 4 md) nil (nth 5 md)
nil)))
- (set-match-data md)))
+ (setq found-match t)
+
+ ;; Unset match data subexpressions that don't apply based on
+ ;; the decl kind.
+ (let ((md (match-data)))
+ (cond
+ ((string= decl "var")
+ (setf (nth 4 md) nil (nth 5 md) nil (nth 6 md) nil (nth 7 md)
nil))
+ ((string= decl "const")
+ (setf (nth 2 md) nil (nth 3 md) nil (nth 6 md) nil (nth 7 md)
nil))
+ ((string= decl "type")
+ (setf (nth 2 md) nil (nth 3 md) nil (nth 4 md) nil (nth 5 md)
nil)))
+ (set-match-data md)))
(t
(save-match-data
- [nongnu] elpa/go-mode ac6dd8c 430/495: Fix go-remove-unused-imports, (continued)
- [nongnu] elpa/go-mode ac6dd8c 430/495: Fix go-remove-unused-imports, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode e8674fe 437/495: Expand electric indent config a bit, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 6a64cbf 439/495: Fix indentation for composite literal keys., ELPA Syncer, 2021/08/07
- [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 <=
- [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, 2021/08/07
- [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