Skip to content

Commit

Permalink
Fix :syn-include usage of Vim filetype.
Browse files Browse the repository at this point in the history
Here’s what the Vim manual says in *:syn-include*:

    :sy[ntax] include [@{grouplist-name}] {file-name}

	All syntax items declared in the included file will have the
	"contained" flag added.  In addition, if a group list is
	specified, all top-level syntax items in the included file will
	be added to that list.

We had two rules for `rustModPath`, one `contained` and the other not.
The effect was that the second (now renamed to `rustModPathInUse`) was
being included in the group list, and thus that all identifiers were
being highlighted as `Include`, which is definitely not what we wanted.
  • Loading branch information
chris-morgan committed Jul 21, 2014
1 parent ca6ffac commit 0a0c6da
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/etc/vim/syntax/rust.vim
Expand Up @@ -3,7 +3,7 @@
" Maintainer: Patrick Walton <pcwalton@mozilla.com>
" Maintainer: Ben Blum <bblum@cs.cmu.edu>
" Maintainer: Chris Morgan <me@chrismorgan.info>
" Last Change: July 06, 2014
" Last Change: July 18, 2014

if version < 600
syntax clear
Expand Down Expand Up @@ -38,7 +38,7 @@ syn keyword rustKeyword for in if impl let
syn keyword rustKeyword loop once proc pub
syn keyword rustKeyword return super
syn keyword rustKeyword unsafe virtual while
syn keyword rustKeyword use nextgroup=rustModPath skipwhite skipempty
syn keyword rustKeyword use nextgroup=rustModPath,rustModPathInUse skipwhite skipempty
" FIXME: Scoped impl's name is also fallen in this category
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite skipempty
syn keyword rustStorage mut ref static const
Expand Down Expand Up @@ -142,8 +142,9 @@ syn keyword rustBoolean true false
" If foo::bar changes to foo.bar, change this ("::" to "\.").
" If foo::bar changes to Foo::bar, change this (first "\w" to "\u").
syn match rustModPath "\w\(\w\)*::[^<]"he=e-3,me=e-3
syn match rustModPath "\w\(\w\)*" contained " only for 'use path;'
syn match rustModPathInUse "\w\(\w\)*" contained " only for 'use path;'
syn match rustModPathSep "::"
" rustModPathInUse is split out from rustModPath so that :syn-include can get the group list right.

syn match rustFuncCall "\w\(\w\)*("he=e-1,me=e-1
syn match rustFuncCall "\w\(\w\)*::<"he=e-3,me=e-3 " foo::<T>();
Expand Down Expand Up @@ -262,6 +263,7 @@ hi def link rustReservedKeyword Error
hi def link rustConditional Conditional
hi def link rustIdentifier Identifier
hi def link rustCapsIdent rustIdentifier
hi def link rustModPathInUse rustModPath
hi def link rustModPath Include
hi def link rustModPathSep Delimiter
hi def link rustFunction Function
Expand Down

13 comments on commit 0a0c6da

@bors
Copy link
Contributor

@bors bors commented on 0a0c6da Jul 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from kballard
at chris-morgan@0a0c6da

@bors
Copy link
Contributor

@bors bors commented on 0a0c6da Jul 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging chris-morgan/rust/vim-misc-2014-07-04 = 0a0c6da into auto

@bors
Copy link
Contributor

@bors bors commented on 0a0c6da Jul 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chris-morgan/rust/vim-misc-2014-07-04 = 0a0c6da merged ok, testing candidate = 7ac9703f

@bors
Copy link
Contributor

@bors bors commented on 0a0c6da Jul 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 0a0c6da Jul 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from kballard
at chris-morgan@0a0c6da

@bors
Copy link
Contributor

@bors bors commented on 0a0c6da Jul 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging chris-morgan/rust/vim-misc-2014-07-04 = 0a0c6da into auto

@bors
Copy link
Contributor

@bors bors commented on 0a0c6da Jul 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chris-morgan/rust/vim-misc-2014-07-04 = 0a0c6da merged ok, testing candidate = 81a2565

@bors
Copy link
Contributor

@bors bors commented on 0a0c6da Jul 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 0a0c6da Jul 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from kballard
at chris-morgan@0a0c6da

@bors
Copy link
Contributor

@bors bors commented on 0a0c6da Jul 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging chris-morgan/rust/vim-misc-2014-07-04 = 0a0c6da into auto

@bors
Copy link
Contributor

@bors bors commented on 0a0c6da Jul 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chris-morgan/rust/vim-misc-2014-07-04 = 0a0c6da merged ok, testing candidate = 9cc39a0

@bors
Copy link
Contributor

@bors bors commented on 0a0c6da Jul 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 9cc39a0

Please sign in to comment.