Skip to content

vim: improve syntax highlighting for typealias #25056

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

Merged
merged 1 commit into from
May 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions utils/vim/syntax/swift.vim
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ syn keyword swiftTypeDefinition skipwhite skipempty nextgroup=swiftTypeName
\ extension
\ protocol
\ struct

syn keyword swiftTypeAliasDefinition skipwhite skipempty nextgroup=swiftTypeAliasName
\ typealias

syn match swiftMultiwordTypeDefinition skipwhite skipempty nextgroup=swiftTypeName
Expand Down Expand Up @@ -109,6 +111,8 @@ syn match swiftImportModule contained nextgroup=swiftImportComponent
syn match swiftImportComponent contained nextgroup=swiftImportComponent
\ /\.\<[A-Za-z_][A-Za-z_0-9]*\>/

syn match swiftTypeAliasName contained skipwhite skipempty nextgroup=swiftTypeAliasValue
\ /\<[A-Za-z_][A-Za-z_0-9]*\>/
syn match swiftTypeName contained skipwhite skipempty nextgroup=swiftTypeParameters
\ /\<[A-Za-z_][A-Za-z_0-9\.]*\>/
syn match swiftVarName contained skipwhite skipempty nextgroup=swiftTypeDeclaration
Expand Down Expand Up @@ -136,6 +140,8 @@ syn region swiftTypeParameters contained contains=swiftVarName,swiftConstraint
syn keyword swiftConstraint contained
\ where

syn match swiftTypeAliasValue skipwhite skipempty nextgroup=swiftType
\ /=/
syn match swiftTypeDeclaration skipwhite skipempty nextgroup=swiftType,swiftInOutKeyword
\ /:/
syn match swiftTypeDeclaration skipwhite skipempty nextgroup=swiftType
Expand Down Expand Up @@ -195,17 +201,20 @@ hi def link swiftTypeDefinition Define
hi def link swiftMultiwordTypeDefinition Define
hi def link swiftType Type
hi def link swiftTypePair Type
hi def link swiftTypeAliasName Identifier
hi def link swiftTypeName Function
hi def link swiftConstraint Special
hi def link swiftFuncDefinition Define
hi def link swiftDefinitionModifier Define
hi def link swiftInOutKeyword Define
hi def link swiftFuncKeyword Function
hi def link swiftFuncKeywordGeneral Function
hi def link swiftTypeAliasDefinition Define
hi def link swiftVarDefinition Define
hi def link swiftVarName Identifier
hi def link swiftImplicitVarName Identifier
hi def link swiftIdentifierKeyword Identifier
hi def link swiftTypeAliasValue Delimiter
hi def link swiftTypeDeclaration Delimiter
hi def link swiftTypeParameters Delimiter
hi def link swiftBoolean Boolean
Expand Down