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

Support crate keyword. #227

Merged
merged 2 commits into from Jul 1, 2018

Conversation

Projects
None yet
5 participants
@davidtwco
Member

davidtwco commented Jul 1, 2018

In the 2018 edition, the crate keyword is valid as a visibility modifier. This PR modifies the syntax highlighting to reflect this (mostly because rustc uses it and seeing it mishighlighted has been bugging me).

@rust-highfive

This comment has been minimized.

rust-highfive commented Jul 1, 2018

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@@ -32,6 +32,7 @@ syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite skipempty
syn keyword rustKeyword in impl let
syn keyword rustKeyword macro
syn keyword rustKeyword pub nextgroup=rustPubScope skipwhite skipempty
syn keyword rustKeyword crate skipwhite skipempty

This comment has been minimized.

@chris-morgan

chris-morgan Jul 1, 2018

Member

skipwhite skipempty is only needed (or desirable) if nextgroup is specified. Also note that all these keywords are in alphabetical order so far, so putting this one with or after continue (I have no particular preference) would be good.

This comment has been minimized.

@davidtwco

davidtwco Jul 1, 2018

Member

Should be fixed now.

@@ -43,8 +44,6 @@ syn keyword rustKeyword mod trait nextgroup=rustIdentifier skipwhite skipe
syn keyword rustStorage move mut ref static const
syn match rustDefault /\<default\ze\_s\+\(impl\|fn\|type\|const\)\>/
syn keyword rustInvalidBareKeyword crate

This comment has been minimized.

@chris-morgan

chris-morgan Jul 1, 2018

Member

Remember to remove its hi def link line too.

This comment has been minimized.

@davidtwco

davidtwco Jul 1, 2018

Member

Should be fixed now.

@@ -154,11 +153,11 @@ syn region rustDerive start="derive(" end=")" contained contains=rustDer
syn keyword rustDeriveTrait contained Clone Hash RustcEncodable RustcDecodable Encodable Decodable PartialEq Eq PartialOrd Ord Rand Show Debug Default FromPrimitive Send Sync Copy
" dyn keyword: It's only a keyword when used inside a type expression, so
" we make effort here to highlight it only when Rust identifiers follow it
" we make effort here to highlight it only when Rust identifiers follow it

This comment has been minimized.

@chris-morgan

chris-morgan Jul 1, 2018

Member

This and the one below it are not pertinent to the matter. Ideally, all the crate stuff will be in one commit, and this other stuff will either not be done, or be in a separate commit. Practice good commit hygiene! It’s fun! Sometimes it’s even useful afterwards! ☺

This comment has been minimized.

@davidtwco

davidtwco Jul 1, 2018

Member

Oops, I didn't even notice this, the editor did it automatically. I'll separate it out.

This comment has been minimized.

@chris-morgan

chris-morgan Jul 1, 2018

Member

A few years ago I got tired of that sort of thing happening, and so I started always using --patch on my git add invocations when modifying existing files (when adding new files you can’t), and verifying that the diff is in fact what I want to commit. With aliases, this means I now type g ap.

The staging area can definitely be helpful if you deliberately make it a part of your process.

This comment has been minimized.

@da-x

da-x Jul 1, 2018

Member

Sorry, it was my editor that introduced those extraneous white spaces. I recently moved to vim-plug and forgot to re-enable bronson/vim-trailing-whitespace.

davidtwco added some commits Jul 1, 2018

@chris-morgan chris-morgan merged commit 1234c2f into rust-lang:master Jul 1, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment