Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(793)

Issue 81240047: code review 81240047: misc/emacs: highlight type names in function parameter list (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 1 month ago by ruiu
Modified:
9 years, 10 months ago
Visibility:
Public.

Description

misc/emacs: highlight type names in function parameter list Currently go-mode does not set font-lock-type-face to type names in a function parameter list. This patch is to set it to highlight them. Context matters to find type names in a parameter list. For example, X and Y are type names in "func(X, Y)" but are not in "func(X, Y int)", so we cannot say if they are type names until we see int or a closing parenthesis in this case. In this patch, we first scan a parameter list to see whether or not the list has names, and scan it again to get positions of type names. All "T"s (and not "x"s and "y"s) in the following code are highlighted with this patch. func (T) func (x T) func (x, y T, z T) func ([]T, T) func (*T, T) func (T) T func (T) *T func (T) (T) func (T) (*T) func (T) (T, T) func (T) (n T, err T) func (T) (m, n T) func fn(T) func fn(T, T, T) func fn(x T) func fn(x, y T, z T) func (T) method(T) T func (x T) method(T) (T, T) func (x T) method(T) (n T, err T) func (x func(x T), y func(T, T) T) func() T

Patch Set 1 #

Patch Set 2 : diff -r dee4c7a24398 https://code.google.com/p/go #

Patch Set 3 : diff -r dee4c7a24398 https://code.google.com/p/go #

Patch Set 4 : diff -r dee4c7a24398 https://code.google.com/p/go #

Patch Set 5 : diff -r dee4c7a24398 https://code.google.com/p/go #

Patch Set 6 : diff -r dee4c7a24398 https://code.google.com/p/go #

Total comments: 6

Patch Set 7 : diff -r 1afdecdd77c1 https://code.google.com/p/go #

Total comments: 12

Patch Set 8 : diff -r 1afdecdd77c1 https://code.google.com/p/go #

Patch Set 9 : diff -r 1afdecdd77c1 https://code.google.com/p/go #

Patch Set 10 : diff -r 1afdecdd77c1 https://code.google.com/p/go #

Patch Set 11 : diff -r 1afdecdd77c1 https://code.google.com/p/go #

Total comments: 2

Patch Set 12 : diff -r 1afdecdd77c1 https://code.google.com/p/go #

Patch Set 13 : diff -r 7d2e78c502ab https://code.google.com/p/go #

Patch Set 14 : diff -r 7d2e78c502ab https://code.google.com/p/go #

Total comments: 16

Patch Set 15 : diff -r 2af1cf6a6559 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+235 lines, -13 lines) Patch
M misc/emacs/go-mode.el View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 7 chunks +235 lines, -13 lines 0 comments Download

Messages

Total messages: 24
ruiu
Hello golang-codereviews@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
10 years, 1 month ago (2014-03-30 06:08:46 UTC) #1
Dominik Honnef
Impressive work. The following comments are just covering some preliminary concerns, I didn't have a ...
10 years, 1 month ago (2014-03-30 07:36:59 UTC) #2
ruiu
Thank you for the quick review. I'll update the code tomorrow according to your comment. ...
10 years, 1 month ago (2014-03-30 08:07:03 UTC) #3
ruiu
https://codereview.appspot.com/81240047/diff/50002/misc/emacs/go-mode.el File misc/emacs/go-mode.el (left): https://codereview.appspot.com/81240047/diff/50002/misc/emacs/go-mode.el#oldcode134 misc/emacs/go-mode.el:134: (defconst go-type-name-regexp (concat "\\(?:[*(]\\)*\\(?:" go-identifier-regexp "\\.\\)?\\(" go-identifier-regexp "\\)")) OK, ...
10 years, 1 month ago (2014-03-30 08:07:32 UTC) #4
ruiu
So I updated the patch with the following changes. - It now handles multi-line function ...
10 years, 1 month ago (2014-03-30 23:47:20 UTC) #5
Dominik Honnef
Only some minor nitpicks. I've tested your changes for a while and couldn't find any ...
10 years, 1 month ago (2014-03-31 01:14:10 UTC) #6
ruiu
Thank you for reviewing. I'll admit that this patch is a little bit overwhelming too, ...
10 years, 1 month ago (2014-03-31 02:30:27 UTC) #7
ruiu
I found that types in the following pattern weren't correctly highlighted because of a regexp ...
10 years, 1 month ago (2014-03-31 05:46:08 UTC) #8
Dominik Honnef
https://codereview.appspot.com/81240047/diff/160001/misc/emacs/go-mode.el File misc/emacs/go-mode.el (right): https://codereview.appspot.com/81240047/diff/160001/misc/emacs/go-mode.el#newcode111 misc/emacs/go-mode.el:111: (defconst go-qualified-identifier-regexp "[[:word:][:multibyte:]]+\\.[[:word:][:multibyte:]]+") It would probably make sense to ...
10 years, 1 month ago (2014-03-31 06:54:05 UTC) #9
ruiu
https://codereview.appspot.com/81240047/diff/160001/misc/emacs/go-mode.el File misc/emacs/go-mode.el (right): https://codereview.appspot.com/81240047/diff/160001/misc/emacs/go-mode.el#newcode111 misc/emacs/go-mode.el:111: (defconst go-qualified-identifier-regexp "[[:word:][:multibyte:]]+\\.[[:word:][:multibyte:]]+") On 2014/03/31 06:54:05, Dominik Honnef wrote: ...
10 years, 1 month ago (2014-03-31 16:03:36 UTC) #10
Dominik Honnef
LGTM Couldn't find any other problems.
10 years, 1 month ago (2014-03-31 20:58:51 UTC) #11
adonovan
On 2014/03/31 20:58:51, Dominik Honnef wrote: > LGTM > > Couldn't find any other problems. ...
10 years, 1 month ago (2014-03-31 21:15:11 UTC) #12
ruiu
Adding Rob and Russ to get their input on Emacs Lisp code and the freeze. ...
10 years, 1 month ago (2014-03-31 21:40:02 UTC) #13
r2
A code freeze is a code freeze. This one doesn't fix a critical bug and ...
10 years, 1 month ago (2014-04-07 05:07:29 UTC) #14
ruiu
Got it. Will ping after the 1.3 release. On Sun, Apr 6, 2014 at 10:07 ...
10 years, 1 month ago (2014-04-07 05:17:22 UTC) #15
ruiu
I've been using this patch for a few months now. It's been working mostly fine, ...
9 years, 11 months ago (2014-06-16 04:33:14 UTC) #16
Dominik Honnef
LGTM but wait for Alan On 2014/06/16 04:33:14, ruiu wrote: > The most notable one ...
9 years, 11 months ago (2014-06-16 15:30:38 UTC) #17
ruiu
> I see that you also adjusted go--match-raw-string-literal – I have no way of > ...
9 years, 11 months ago (2014-06-16 18:05:08 UTC) #18
adonovan
I feel uneasy about this change. It adds 220 lines of dense, untested logic, to ...
9 years, 11 months ago (2014-06-17 17:06:21 UTC) #19
ruiu
On 2014/06/17 17:06:21, adonovan wrote: > I feel uneasy about this change. It adds 220 ...
9 years, 11 months ago (2014-06-17 21:18:07 UTC) #20
Dominik Honnef
Regarding speed: I've been using this patch (when it was still doing multi-line, too) for ...
9 years, 11 months ago (2014-06-17 21:21:36 UTC) #21
ruiu
https://codereview.appspot.com/81240047/diff/220001/misc/emacs/go-mode.el File misc/emacs/go-mode.el (right): https://codereview.appspot.com/81240047/diff/220001/misc/emacs/go-mode.el#newcode139 misc/emacs/go-mode.el:139: ;; Maximum number of identifiers that can be highlighted ...
9 years, 11 months ago (2014-06-18 02:17:49 UTC) #22
ruiu
*** Abandoned ***
9 years, 10 months ago (2014-06-28 00:16:55 UTC) #23
ruiu
9 years, 10 months ago (2014-07-01 17:59:12 UTC) #24
Message was sent while issue was closed.
Alan,

If you have further comments on this CL, please send them here or at
https://github.com/dominikh/go-mode.el/pull/54. I'm proposing to merge this to
Dominik's GitHub repository and wondering if you still want to finish your code
review. Thanks.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b