-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
highlight predefined identifiers #1939
Conversation
This was changed from keywords to the regexp in fatih#605, but I think that was a mistake. If you do `new := "foo"` then this is perfectly valid Go, but I don't think it's a bad thing to add a reminder that you're actually overriding a global built-in by highlighting the `new`, just as it's not a bad idea to highlight the `new()` in `func new()` to serve as a similar reminder. This is a common-ish mistake that most of us have probably made at least once or twice. The only case where this fails is in method declaration and calls: func () x new() { other.new() } But this is the case with the current highlight as well, so it doesn't make that worse.
This applies the changes from #1782 with the modifications that I suggested there edit: strike through the portion that's no longer relevant. |
They are? Both link back to This has been discussed extensively in #1782, as well as in Slack, and a similar change was reverted in #1030. I think your proposal is poor UX. Highlighting e.g. When it comes to syntax highlighting no one cares what the spec says, for all practical purposes |
Perhaps it's bright; iTerm2 has has some issues with its solarized color scheme, so that's probably just an issue on my machine. I'll revert that piece. |
I force pushed to remove that second commit. |
I checked
If we take a step back and think about this, is All these builtin functions are indeed special and I think we should treat them that way. It's stupid overriding the I really don't want this topic to be derailed like this, however, I always aimed to make things better for the user. Some of the examples top of my mind which are different:
There are many such things in the code base. So yes, sometimes we need to aim for correctness, but not in expense of a worse UX. Having said that, I think it's ok to remove the Those are my two cents . We should remove the |
Closed since I'm travelling today. Martin's previous PR be reopened and merged to get the desired result. |
Would like to see a FAQ entry describing how to change the syntax highlighting so the builtins are highlighted as keywords. |
lgtm |
Match builtins as keywords and highlight with the Identifier group.
This was changed from keywords to the regexp in #605, but I think that
was a mistake.
If you do
new := "foo"
then this is perfectly valid Go, but I don'tthink it's a bad thing to add a reminder that you're actually overriding
a global built-in by highlighting the
new
, just as it's not a bad ideato highlight the
new()
infunc new()
to serve as a similar reminder.This is a common-ish mistake that most of us have probably made at least
once or twice.
The only case where this fails is in method declaration and calls:
But this is the case with the current highlight as well, so it doesn't
make that worse.
If users want the previous (or different) behavior, they are free to
link the groups to different highlighting groups in their configs.
edit: removed the description of a commit that was removed from the PR.