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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ syn match rustPanic "\<panic\(\w\)*!" contained | |
syn keyword rustKeyword break | ||
syn keyword rustKeyword box nextgroup=rustBoxPlacement skipwhite skipempty | ||
syn keyword rustKeyword continue | ||
syn keyword rustKeyword crate | ||
syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite skipempty | ||
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite skipempty | ||
syn keyword rustKeyword in impl let | ||
|
@@ -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 | ||
|
||
syn keyword rustPubScopeCrate crate contained | ||
syn match rustPubScopeDelim /[()]/ contained | ||
syn match rustPubScope /([^()]*)/ contained contains=rustPubScopeDelim,rustPubScopeCrate,rustSuper,rustModPath,rustModPathSep,rustSelf transparent | ||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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! ☺ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, I didn't even notice this, the editor did it automatically. I'll separate it out. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A few years ago I got tired of that sort of thing happening, and so I started always using The staging area can definitely be helpful if you deliberately make it a part of your process. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, it was my editor that introduced those extraneous white spaces. I recently moved to vim-plug and forgot to re-enable |
||
" (not minding the case of pre-2018 Rust where a path starting with :: can | ||
" follow). | ||
" | ||
" This is so that uses of dyn variable names such as in 'let &dyn = &2' | ||
" This is so that uses of dyn variable names such as in 'let &dyn = &2' | ||
" and 'let dyn = 2' will not get highlighted as a keyword. | ||
syn match rustKeyword "\<dyn\ze\_s\+\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)" contains=rustDynKeyword | ||
syn keyword rustDynKeyword dyn contained | ||
|
@@ -291,7 +290,6 @@ hi def link rustStorage StorageClass | |
hi def link rustObsoleteStorage Error | ||
hi def link rustLifetime Special | ||
hi def link rustLabel Label | ||
hi def link rustInvalidBareKeyword Error | ||
hi def link rustExternCrate rustKeyword | ||
hi def link rustObsoleteExternMod Error | ||
hi def link rustBoxPlacementParens Delimiter | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to remove its
hi def link
line too.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed now.