Skip to content

Commit 0d600fd

Browse files
committed
vim: highlight attributed function declarations
Check for a type declaration following an attribute. This corrects the highlighting of function types such as: @NoEscape (Wrapped) throws -> T
1 parent a756131 commit 0d600fd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

utils/vim/syntax/swift.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ syn match swiftParamDelim contained
104104
" <Generic Clause> (generics)
105105
syn region swiftTypeParameters contained contains=swiftArchetype,swiftConstraint
106106
\ start="<" end=">"
107-
syn match swiftArchetype contained skipwhite nextgroup=swiftColonType
107+
syn match swiftArchetype contained skipwhite nextgroup=swiftTypeDeclaration
108108
\ /\<[A-Za-z_][A-Za-z_0-9]*\>/
109109
syn keyword swiftConstraint contained
110110
\ where
@@ -144,7 +144,7 @@ syn keyword swiftLabel get set
144144
syn match swiftPreproc /^\s*#\(\<if\>\|\<else\>\|\<elseif\>\|\<endif\>\)/
145145
syn region swiftPreprocFalse start="^\s*#\<if\>\s\+\<false\>" end="^\s*#\(\<else\>\|\<elseif\>\|\<endif\>\)"
146146

147-
syn match swiftAttribute /@\<\w\+\>/
147+
syn match swiftAttribute /@\<\w\+\>/ skipwhite nextgroup=swiftType
148148

149149
syn keyword swiftTodo TODO FIXME contained
150150
syn keyword swiftNil nil

0 commit comments

Comments
 (0)