Skip to content

Commit

Permalink
Updated for 0.16.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklockwood committed Nov 3, 2016
1 parent fba8f28 commit a98110e
Show file tree
Hide file tree
Showing 42 changed files with 85 additions and 50 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## [0.16.2](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.16.2) (2016-11-03)

- Fixed bug with spacing of deeply nested generic arguments, or generic operator functions
- Fixed spacing of `@autoclosure(escaping)` syntax (only used in Swift 2.2)
- Fixed bug where `(Void) throws -> Void` was handled incorrectly

## [0.16.1](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.16.1) (2016-11-03)

- Fixed critical bug where `redundantParens` would remove parens from tuple in `switch` condition
Expand Down
4 changes: 2 additions & 2 deletions CommandLineTool/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// main.swift
// SwiftFormat
//
// Version 0.16.1
// Version 0.16.2
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
Expand Down Expand Up @@ -33,7 +33,7 @@

import Foundation

let version = "0.16.1"
let version = "0.16.2"

let arguments = [
"output",
Expand Down
Binary file modified CommandLineTool/swiftformat
Binary file not shown.
2 changes: 1 addition & 1 deletion EditorExtension/Application/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.16.1</string>
<string>0.16.2</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSMinimumSystemVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion EditorExtension/Extension/CommandErrors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// CommandErrors.swift
// Swift Formatter
//
// Version 0.16.1
// Version 0.16.2
//
// Created by Tony Arnold on 6/10/16.
// Copyright 2016 Nick Lockwood
Expand Down
2 changes: 1 addition & 1 deletion EditorExtension/Extension/FormatEntireFileCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// FormatEntireFileCommand.swift
// Swift Formatter
//
// Version 0.16.1
// Version 0.16.2
//
// Created by Tony Arnold on 5/10/16.
// Copyright 2016 Nick Lockwood
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// FormatSelectedSourceCommand.swift
// Swift Formatter
//
// Version 0.16.1
// Version 0.16.2
//
// Created by Tony Arnold on 5/10/16.
// Copyright 2016 Nick Lockwood
Expand Down
2 changes: 1 addition & 1 deletion EditorExtension/Extension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>0.16.1</string>
<string>0.16.2</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSMinimumSystemVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion EditorExtension/Extension/SourceEditorExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SourceEditorExtension.swift
// Swift Formatter
//
// Version 0.16.1
// Version 0.16.2
//
// Created by Tony Arnold on 5/10/16.
// Copyright 2016 Nick Lockwood
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// XCSourceTextBuffer+SwiftFormat.swift
// SwiftFormat
//
// Version 0.16.1
// Version 0.16.2
//
// Created by Nick Lockwood on 21/10/2016.
// Copyright © 2016 Nick Lockwood. All rights reserved.
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.16.1</string>
<string>0.16.2</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>0.16.1</string>
<string>0.16.2</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
<dict>
<key>Resources/Base.lproj/Main.storyboardc/Info.plist</key>
<data>
9zRMIOeu8p18vhTjQt1JrWjdUTs=
t7ojotPoqWQiIaUFnkpbaO+flWg=
</data>
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
<data>
wWbzKzgCybMyXC74xwL2Z5YgIhQ=
u5+f2LM7oP7l+ZaVYRrDQefNp40=
</data>
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
<data>
tElWgi1r/6JdsD1G0XZxmkUhXqQ=
/456IPsK5PuQmTxIbZYziYSzzFY=
</data>
<key>Resources/Base.lproj/Main.storyboardc/ViewController.nib</key>
<data>
WpPoKzQON29fgzeTKpsPBOBkJ4M=
1bitQ76vDK8r6vTuVC2FA7cbPgQ=
</data>
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
<data>
Y+ryX87SiZeJNYOWewGKWPEAIBM=
79S1r8lbSuDTeykfmldXcyWgP1E=
</data>
<key>Resources/libswiftRemoteMirror.dylib</key>
<data>
Expand Down Expand Up @@ -152,7 +152,7 @@
<dict>
<key>cdhash</key>
<data>
Vx/qHHf7DgAaB15JCEO7B3tpevA=
FN8XhbhvOhC8ZAB4REPWZqj/FyU=
</data>
<key>requirement</key>
<string>identifier "com.charcoaldesign.SwiftFormat-for-Xcode.SourceEditorExtension" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
Expand All @@ -161,55 +161,55 @@
<dict>
<key>hash</key>
<data>
9zRMIOeu8p18vhTjQt1JrWjdUTs=
t7ojotPoqWQiIaUFnkpbaO+flWg=
</data>
<key>hash2</key>
<data>
Qdqh1N6PKRznd9n/Fb14jWvlk8SuioJcOyQMXMCfrnA=
zmv5lfRPMHfIOXEylIeqNinrajlghabiHUg1eRbNKsc=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
<dict>
<key>hash</key>
<data>
wWbzKzgCybMyXC74xwL2Z5YgIhQ=
u5+f2LM7oP7l+ZaVYRrDQefNp40=
</data>
<key>hash2</key>
<data>
gkhRt2yNPyEhIE9bfT1EWWvFbcvm8Hd6iSDCDDrdizU=
myntpeKzM1/OixyVynJxXGOycQJO6WNabEivPgyZCBk=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
<dict>
<key>hash</key>
<data>
tElWgi1r/6JdsD1G0XZxmkUhXqQ=
/456IPsK5PuQmTxIbZYziYSzzFY=
</data>
<key>hash2</key>
<data>
fOLIzn6WKP1Jn5n+SZ8Ekh6v6e/SZ/8doJbacGp69r8=
wyg4nPPTdRqGaYhhfXzUrT8yefTxL556CQFpgVLYnFI=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/ViewController.nib</key>
<dict>
<key>hash</key>
<data>
WpPoKzQON29fgzeTKpsPBOBkJ4M=
1bitQ76vDK8r6vTuVC2FA7cbPgQ=
</data>
<key>hash2</key>
<data>
bJL/EJkm1/Drv1jwTSyZ7ZQkMwITkipqt5l5r6+eHo0=
/zpEv8r0eyjQyUvMR/b3IfJOPb5KFId02xJ3rsQb+m4=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
<dict>
<key>hash</key>
<data>
Y+ryX87SiZeJNYOWewGKWPEAIBM=
79S1r8lbSuDTeykfmldXcyWgP1E=
</data>
<key>hash2</key>
<data>
daqWq+TKCbBl98nq/S6rMSGR+ARaqD6QnacOix2wS8E=
kMovzhtLaeJjdb3BH9vs9WKpEaUX5FQXxXPY+0waFyE=
</data>
</dict>
<key>Resources/libswiftRemoteMirror.dylib</key>
Expand Down
4 changes: 2 additions & 2 deletions SwiftFormat.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SwiftFormat",
"version": "0.16.1",
"version": "0.16.2",
"license": {
"type": "zlib",
"file": "LICENCE.md"
Expand All @@ -10,7 +10,7 @@
"authors": "Nick Lockwood",
"source": {
"git": "https://github.com/nicklockwood/SwiftFormat.git",
"tag": "0.16.1"
"tag": "0.16.2"
},
"source_files": "SwiftFormat",
"requires_arc": true,
Expand Down
2 changes: 1 addition & 1 deletion SwiftFormat/Formatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Formatter.swift
// SwiftFormat
//
// Version 0.16.1
// Version 0.16.2
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
Expand Down
2 changes: 1 addition & 1 deletion SwiftFormat/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.16.1</string>
<string>0.16.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
29 changes: 27 additions & 2 deletions SwiftFormat/Options.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
//
// Options.swift
// Rules.swift
// SwiftFormat
//
// Version 0.16.2
//
// Created by Nick Lockwood on 21/10/2016.
// Copyright © 2016 Nick Lockwood. All rights reserved.
// Copyright 2016 Nick Lockwood
//
// Distributed under the permissive zlib license
// Get the latest version from here:
//
// https://github.com/nicklockwood/SwiftFormat
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//

/// Configuration options for formatting. These aren't actually used by the
Expand Down
15 changes: 11 additions & 4 deletions SwiftFormat/Rules.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Rules.swift
// SwiftFormat
//
// Version 0.16.1
// Version 0.16.2
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
Expand Down Expand Up @@ -1174,10 +1174,17 @@ public func todos(_ formatter: Formatter) {
for tag in ["TODO", "MARK", "FIXME"] {
if string.hasPrefix(tag) {
var suffix = string.substring(from: tag.endIndex)
while suffix.characters.first == " " || suffix.characters.first == ":" {
suffix = suffix.substring(from: suffix.characters.index(suffix.startIndex, offsetBy: 1))
if let first = suffix.characters.first {
// If not followed by a space or :, don't mess with it as it may be a custom format
if " :".characters.contains(first) {
while let first = suffix.characters.first, " :".characters.contains(first) {
suffix = suffix.substring(from: suffix.index(after: suffix.startIndex))
}
formatter.replaceTokenAtIndex(i, with: .commentBody(tag + ": " + suffix))
}
} else {
formatter.replaceTokenAtIndex(i, with: .commentBody(tag + ":"))
}
formatter.replaceTokenAtIndex(i, with: .commentBody(tag + ": " + suffix))
break
}
}
Expand Down
2 changes: 1 addition & 1 deletion SwiftFormat/SwiftFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SwiftFormat.h
// SwiftFormat
//
// Version 0.16.1
// Version 0.16.2
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
Expand Down
2 changes: 1 addition & 1 deletion SwiftFormat/SwiftFormat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SwiftFormat.swift
// SwiftFormat
//
// Version 0.16.1
// Version 0.16.2
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
Expand Down
17 changes: 7 additions & 10 deletions SwiftFormat/Tokenizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Tokenizer.swift
// SwiftFormat
//
// Version 0.16.1
// Version 0.16.2
//
// Created by Nick Lockwood on 11/08/2016.
// Copyright 2016 Nick Lockwood
Expand Down Expand Up @@ -730,12 +730,6 @@ public func tokenize(_ source: String) -> [Token] {
flushCommentBodyTokens()
}

func convertOpeningChevronToSymbol(atScopeStackIndex index: Int) {
let scopeIndex = scopeIndexStack[index]
scopeIndexStack.remove(at: index)
convertOpeningChevronToSymbol(at: scopeIndex)
}

func convertOpeningChevronToSymbol(at index: Int) {
assert(tokens[index] == .startOfScope("<"))
tokens[index] = .symbol("<")
Expand Down Expand Up @@ -899,12 +893,14 @@ public func tokenize(_ source: String) -> [Token] {
break
default:
// Not a generic scope
convertOpeningChevronToSymbol(atScopeStackIndex: scopeIndexStack.count - 1)
convertOpeningChevronToSymbol(at: scopeIndex)
scopeIndexStack.removeLast()
}
case .endOfScope:
// If we encountered a closing scope token that wasn't >
// then the opening < must have been an operator after all
convertOpeningChevronToSymbol(atScopeStackIndex: scopeIndexStack.count - 1)
convertOpeningChevronToSymbol(at: scopeIndex)
scopeIndexStack.removeLast()
processToken()
return
default:
Expand Down Expand Up @@ -952,7 +948,8 @@ public func tokenize(_ source: String) -> [Token] {
case .startOfScope("<"):
// If we encountered an end-of-file while a generic scope was
// still open, the opening < must have been an operator
convertOpeningChevronToSymbol(atScopeStackIndex: scopeIndexStack.count - 1)
convertOpeningChevronToSymbol(at: scopeIndex)
scopeIndexStack.removeLast()
case .startOfScope("//"):
break
default:
Expand Down
2 changes: 1 addition & 1 deletion SwiftFormatTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.16.1</string>
<string>0.16.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down

0 comments on commit a98110e

Please sign in to comment.