Skip to content

Commit 41d75c0

Browse files
committed
Make swiftInterpolatedWrapper only span a single line
This is part of the language and previously broken syntax highlighting broken everything below it as well. Now the highlighting is fixed as well. It was fallout from changing the type wrapper to contain ALL.
1 parent 7d7c6e3 commit 41d75c0

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

example/example.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ thing = map.optionalFrom("string") ?? .Fallback
318318

319319
// This should not break all highlighting
320320
print("Copying \(NSProcessInfo().environment["SCRIPT_INPUT_FILE_\(index)"]!)")
321+
// Neither should this
322+
return addressParts.count == 2 ? addressParts[1] : "\(addressParts[1]), \(addressParts[2])"
321323

322324
// This is multiline garbage
323325
"foo

syntax/swift.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ delfunction s:CommentKeywordMatch
5454
" Literals
5555
" Strings
5656
syntax region swiftString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=swiftInterpolatedWrapper oneline
57-
syntax region swiftInterpolatedWrapper start="\v[^\\]\\\(\s*" end="\v\s*\)" contained containedin=swiftString contains=swiftInterpolatedString,swiftString
58-
syntax match swiftInterpolatedString "\v\w+(\(\))?" contained containedin=swiftInterpolatedWrapper
57+
syntax region swiftInterpolatedWrapper start="\v[^\\]\\\(\s*" end="\v\s*\)" contained containedin=swiftString contains=swiftInterpolatedString,swiftString oneline
58+
syntax match swiftInterpolatedString "\v\w+(\(\))?" contained containedin=swiftInterpolatedWrapper oneline
5959

6060
" Numbers
6161
syntax match swiftNumber "\v<\d+>"
@@ -199,7 +199,7 @@ syntax keyword swiftStructure
199199
\ struct
200200
\ enum
201201

202-
syntax region swiftTypeWrapper start="\v:\s*" skip="\s*,\s*$*\s*" end="$\|/"me=e-1 contains=ALL transparent
202+
syntax region swiftTypeWrapper start="\v:\s*" skip="\s*,\s*$*\s*" end="$\|/"me=e-1 contains=ALLBUT,swiftInterpolatedWrapper transparent
203203
syntax region swiftGenericsWrapper start="\v\<" end="\v\>" contains=swiftType transparent oneline
204204
syntax region swiftLiteralWrapper start="\v\=\s*" skip="\v[^\[\]]\(\)" end="\v(\[\]|\(\))" contains=ALL transparent oneline
205205
syntax region swiftReturnWrapper start="\v-\>\s*" end="\v(\{|$)" contains=swiftType transparent oneline

0 commit comments

Comments
 (0)