Skip to content

Commit c95598d

Browse files
mossheimCodaFi
authored andcommitted
Vim plugin: expand highlighting coverage (#11444)
* vim-syntax: fix highlighting for indirect case/enum without skipwhite, `indirect enum` never gets highlighted. this commit also adds the `indirect case` multiword keyword. * vim-syntax: allow whitespace before type parameters Added skipwhite to multiple match groups so that whitespace can be used before type parameters (`Type <Param>`). This matches Xcode's behavior. * vim-syntax: update last change line * vim-syntax: remove indirect case from multiword type def group
1 parent 7ae7cc5 commit c95598d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

utils/vim/syntax/swift.vim

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" Vim syntax file
22
" Language: swift
33
" Maintainer: Joe Groff <[email protected]>
4-
" Last Change: 2013 Feb 2
4+
" Last Change: 2017 Aug 12
55

66
if exists("b:current_syntax")
77
finish
@@ -83,7 +83,8 @@ syn keyword swiftTypeDefinition skipwhite nextgroup=swiftTypeName
8383
\ protocol
8484
\ struct
8585
\ typealias
86-
syn match swiftMultiwordTypeDefinition nextgroup=swiftTypeName
86+
87+
syn match swiftMultiwordTypeDefinition skipwhite nextgroup=swiftTypeName
8788
\ "indirect enum"
8889

8990
syn keyword swiftVarDefinition skipwhite nextgroup=swiftVarName
@@ -108,20 +109,20 @@ syn match swiftImportModule contained nextgroup=swiftImportComponent
108109
syn match swiftImportComponent contained nextgroup=swiftImportComponent
109110
\ /\.\<[A-Za-z_][A-Za-z_0-9]*\>/
110111

111-
syn match swiftTypeName contained nextgroup=swiftTypeParameters
112+
syn match swiftTypeName contained skipwhite nextgroup=swiftTypeParameters
112113
\ /\<[A-Za-z_][A-Za-z_0-9\.]*\>/
113114
syn match swiftVarName contained skipwhite nextgroup=swiftTypeDeclaration
114115
\ /\<[A-Za-z_][A-Za-z_0-9]*\>/
115116
syn match swiftImplicitVarName
116117
\ /\$\<[A-Za-z_0-9]\+\>/
117118

118119
" TypeName[Optionality]?
119-
syn match swiftType contained nextgroup=swiftTypeParameters
120+
syn match swiftType contained skipwhite nextgroup=swiftTypeParameters
120121
\ /\<[A-Za-z_][A-Za-z_0-9\.]*\>[!?]\?/
121122
" [Type:Type] (dictionary) or [Type] (array)
122123
syn region swiftType contained contains=swiftTypePair,swiftType
123124
\ matchgroup=Delimiter start=/\[/ end=/\]/
124-
syn match swiftTypePair contained nextgroup=swiftTypeParameters,swiftTypeDeclaration
125+
syn match swiftTypePair contained skipwhite nextgroup=swiftTypeParameters,swiftTypeDeclaration
125126
\ /\<[A-Za-z_][A-Za-z_0-9\.]*\>[!?]\?/
126127
" (Type[, Type]) (tuple)
127128
" FIXME: we should be able to use skip="," and drop swiftParamDelim

0 commit comments

Comments
 (0)