-
-
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
build constraint fixes #589
Conversation
Thanks @chrisnc This is huge and awesome! I'll be not available for two weeks. I'll be on my way to dotgo.eu for my talk, so I have little time. Just wanted to you give a heads up here. |
add missing architectures remove multiline comment pattern for build constraints (build constraints must always be line comments) add a required trailing space to the build constraint region start pattern this avoids highlighting, e.g., // +buildwindows add a syntax match for package documentation comments that disables highlighting build constraints when they will be interpreted as package documentation instead in build constraints, only use the comment color to highlight the leading //
No problem. Let me know when you get a chance to try it out. I've really appreciated the plugin so far, so I'm glad to contribute to it. I have some other ideas for doing similar kinds of highlighting assistance for |
I'm not sure quite how to do this, but I'd like to also prevent highlighting build constraints that appear after the |
…with the race detector
Hi @chrisnc. Just tested it and this is really awesome :) Works perfect and I really like it. Awesome contribution 👍 |
Great! Thanks for merging. |
What is your feeling on leaving this feature off by default? I don't feel strongly either way, but I wonder if it might save some people who didn't know about the |
@chrisnc syntax highlighting is expensive. Most of the complaints comes from vim-go being slow and when profiled %99 is syntax highlighting. That's the reason we disable most of the syntax highlighting functions. Another reason is that people don't like colorful code. I know this is really useful, but in the end what matters is the general speed for all of our users. |
Ah, okay, that makes sense. I wasn't thinking about the perf impact. |
Some improvements and fixes to the
g:go_highlight_build_constraints
feature:GOARCH
values:arm64
,ppc64
, andppc64le
// +buildwindows
which is not a valid build constraint//
as a comment; other words in the build constraint can be valid build tags other thanGOOS
,GOARCH
,cgo
, andignore
, so they should be treated as identifiersThis won't highlight the constraint because it's followed by
package
:This will highlight the constraint:
The first commit just fixes some inconsistent whitespace in syntax/go.vim.
I appreciate any feedback or suggestions. Thanks!