[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode 53c76cd 480/495: Speed up slow fontification after
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode 53c76cd 480/495: Speed up slow fontification after unclosed parens. |
Date: |
Sat, 7 Aug 2021 09:06:13 -0400 (EDT) |
branch: elpa/go-mode
commit 53c76cddf54638dea5e4cae99ce0181de28e1064
Author: Muir Manders <muir@mnd.rs>
Commit: Peter Sanford <psanford@sanford.io>
Speed up slow fontification after unclosed parens.
To handle multi line param lists we "expand" the fontification scope
to the closing paren. If there is no balanced closing paren then we
expand the scope to the end of the file, which fontifies too much
stuff and makes typing very slow.
For example, typing is slow at <>:
func (myReceive<>
... lots of lines in rest of file ...
Add a quick fix to check that the paren is closed by the end of the
file. If it isn't closed, then don't expand the region. There is more
work to do here (e.g. func literals inside giant functions will still
be slow), but this should resolve the worst slowness.
Fixes #335.
Closes: #336 [via git-merge-pr]
---
go-mode.el | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/go-mode.el b/go-mode.el
index 3e85545..8bcc8e4 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -1333,9 +1333,15 @@ func foo(i, j int) {}
;; multiline param list.
(save-excursion
(let ((depth (go-paren-level)))
- (while (and
- (re-search-forward ")" nil t)
- (>= (go-paren-level) depth))))
+ ;; First check that our paren is closed by the end of the file. This
+ ;; avoids expanding the fontification region to the entire file when you
+ ;; have an unclosed paren at file scope.
+ (when (save-excursion
+ (goto-char (1+ (buffer-size)))
+ (< (go-paren-level) depth))
+ (while (and
+ (re-search-forward ")" nil t)
+ (>= (go-paren-level) depth)))))
(point)))
(defun go--fontify-param-post ()
- [nongnu] elpa/go-mode 9ab06b3 443/495: indent: fix nested dangling lines that don't use parens, (continued)
- [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, 2021/08/07
- [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 <=
- [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
- [nongnu] elpa/go-mode 409cc64 344/495: cmd/oracle: usability improvements to "describe", "referrers", ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode d9d47fa 332/495: go.tools/oracle: change -ptalog default to ""., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode bd236e5 367/495: cmd/guru: emacs: update default-directory, ELPA Syncer, 2021/08/07