mirror of
https://github.com/nicklockwood/SwiftFormat.git
synced 2026-05-17 10:30:35 +00:00
Updated for 0.19 release
This commit is contained in:
@@ -1,5 +1,16 @@
|
||||
# Change Log
|
||||
|
||||
## [0.19](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.19) (2016-12-02)
|
||||
|
||||
- Fixed a critical bug where `redundantParens` rule failed to insert space before a prefix operator
|
||||
- Fixed a crash when encountering generic arguments followed by ...
|
||||
- Added `--disable` option for individually disabling rules without needing to recompile
|
||||
- Added `--rules` command to display all the supported rules (useful in conjunction with `--disable`)
|
||||
- Added `--wraparguments` option for controlling how function arguments are wrapped
|
||||
- Added `--wrapelements` option for controlling how array and dictionary elements are wrapped
|
||||
- Added `--symlinks` option for specifying if symlinks/aliases should be followed and formatted
|
||||
- Fixed bug where symlinks to Swift files would be replaced by a copy of the file
|
||||
|
||||
## [0.18](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.18) (2016-11-17)
|
||||
|
||||
- Added `--inferoptions` command line argument for auto-configuring format options from existing source
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// main.swift
|
||||
// SwiftFormat
|
||||
//
|
||||
// Version 0.18
|
||||
// Version 0.19
|
||||
//
|
||||
// Created by Nick Lockwood on 12/08/2016.
|
||||
// Copyright 2016 Nick Lockwood
|
||||
|
||||
Binary file not shown.
@@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.18</string>
|
||||
<string>0.19</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// CommandErrors.swift
|
||||
// Swift Formatter
|
||||
//
|
||||
// Version 0.18
|
||||
// Version 0.19
|
||||
//
|
||||
// Created by Tony Arnold on 6/10/16.
|
||||
// Copyright 2016 Nick Lockwood
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.18</string>
|
||||
<string>0.19</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SourceEditorExtension.swift
|
||||
// Swift Formatter
|
||||
//
|
||||
// Version 0.18
|
||||
// Version 0.19
|
||||
//
|
||||
// Created by Tony Arnold on 5/10/16.
|
||||
// Copyright 2016 Nick Lockwood
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// XCSourceTextBuffer+SwiftFormat.swift
|
||||
// SwiftFormat
|
||||
//
|
||||
// Version 0.18
|
||||
// Version 0.19
|
||||
//
|
||||
// Created by Nick Lockwood on 21/10/2016.
|
||||
// Copyright © 2016 Nick Lockwood. All rights reserved.
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
@@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.18</string>
|
||||
<string>0.19</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>MacOSX</string>
|
||||
|
||||
Binary file not shown.
+1
-1
@@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.18</string>
|
||||
<string>0.19</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>MacOSX</string>
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -6,23 +6,23 @@
|
||||
<dict>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/Info.plist</key>
|
||||
<data>
|
||||
SVeb6wo91KoqRG8b+oZSU9Avt7A=
|
||||
YjYkhDriztgJEVEA6n+U8soGFVk=
|
||||
</data>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
|
||||
<data>
|
||||
sN8O3bl+2BJUw5XUGGsQ8siffSk=
|
||||
t04Htts8onTlxnsH2ugv6VjH+Rw=
|
||||
</data>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
|
||||
<data>
|
||||
5+fFBogUnh1rkYGxsn0KkHyhKX0=
|
||||
4S4JnwHJSdHMNYLIqjdQM9p0ik0=
|
||||
</data>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/ViewController.nib</key>
|
||||
<data>
|
||||
X2cHOjBiTdCe78QmJBR0WLuUl+g=
|
||||
GIIrpDBq6KRTRBCDkJ+mLPp8sYE=
|
||||
</data>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
|
||||
<data>
|
||||
YF02pwee/elsEubOY2xXqAemPzk=
|
||||
hDxsx6x5l8K4dT8JG6cg0gMSgNY=
|
||||
</data>
|
||||
<key>Resources/libswiftRemoteMirror.dylib</key>
|
||||
<data>
|
||||
@@ -130,15 +130,6 @@
|
||||
<key>requirement</key>
|
||||
<string>identifier "com.apple.dt.runtime.swiftQuartzCore" 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>
|
||||
</dict>
|
||||
<key>Frameworks/libswiftSwiftOnoneSupport.dylib</key>
|
||||
<dict>
|
||||
<key>cdhash</key>
|
||||
<data>
|
||||
oYjIzrxU6mKnhdB6cQcN7nWj9+Q=
|
||||
</data>
|
||||
<key>requirement</key>
|
||||
<string>identifier "com.apple.dt.runtime.swiftSwiftOnoneSupport" 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>
|
||||
</dict>
|
||||
<key>Frameworks/libswiftXPC.dylib</key>
|
||||
<dict>
|
||||
<key>cdhash</key>
|
||||
@@ -152,7 +143,7 @@
|
||||
<dict>
|
||||
<key>cdhash</key>
|
||||
<data>
|
||||
1T4YIjNlliI+DKLvxMi2wNYFiZE=
|
||||
huPJGCXbfxPkMZRLLGtgzyXWvMc=
|
||||
</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>
|
||||
@@ -161,55 +152,55 @@
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
SVeb6wo91KoqRG8b+oZSU9Avt7A=
|
||||
YjYkhDriztgJEVEA6n+U8soGFVk=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
om7q/0Ol35lOxcSZ34buMe3zHvQV1uReEH/9ZI4BrIk=
|
||||
1Wc1BiX54CRJdn/Lrdh9aNumi63MLOXR3SM0rz+L78k=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
sN8O3bl+2BJUw5XUGGsQ8siffSk=
|
||||
t04Htts8onTlxnsH2ugv6VjH+Rw=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
tsM5NttIV+NPg3wZOtWaDMMpmUhl9MmFIPYUbZmIkLU=
|
||||
oaLmgw5ed9Wx2i82fXM6/tpQqn1QCVJB/XEKy1qv0V4=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
5+fFBogUnh1rkYGxsn0KkHyhKX0=
|
||||
4S4JnwHJSdHMNYLIqjdQM9p0ik0=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
kXqhlD43R7DrmdCiW9DPYjq4xpDfUBbLIzWnbEm1lWM=
|
||||
sYZZppU2+8ZAkWN6ZEDjICNTRVS/g4QqLEef4O8CRA8=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/ViewController.nib</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
X2cHOjBiTdCe78QmJBR0WLuUl+g=
|
||||
GIIrpDBq6KRTRBCDkJ+mLPp8sYE=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
2WfozzASTvlaVNYKyOJdKz7jL2RrkHI/XYlRR+sOAgQ=
|
||||
CyHbI2xgAoB7Ad/P9QY9VD2v60D/CWd1ibugMueE44w=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
YF02pwee/elsEubOY2xXqAemPzk=
|
||||
hDxsx6x5l8K4dT8JG6cg0gMSgNY=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
HKnfbKws9vvmsK4fozFI4suK+hXXtFs6CQbIxDpMJ1g=
|
||||
rcKitZlRCPLgC16kjU6rmlDs8TozMI8XTD/2s4T3t4w=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/libswiftRemoteMirror.dylib</key>
|
||||
|
||||
@@ -34,20 +34,16 @@ That depends. There are four ways you can use SwiftFormat:
|
||||
Command-line tool
|
||||
-------------------
|
||||
|
||||
There are multiple options for installing SwiftFormat.
|
||||
**Installation:**
|
||||
|
||||
**Homebrew:**
|
||||
The simplest way to install the `swiftformat` command-line tool is via [Homebrew](http://brew.sh/). If you already have Homebrew installed, just type
|
||||
|
||||
You can use [Homebrew](http://brew.sh/) and install the SwiftFormat tool on your system simply by running the following:
|
||||
> brew update
|
||||
> brew install swiftformat
|
||||
|
||||
Then you're done. Alternatively, to build it yourself from source:
|
||||
|
||||
```
|
||||
brew update
|
||||
brew install swiftformat
|
||||
```
|
||||
|
||||
**Manual Installation:**
|
||||
|
||||
1. The latest binary version of the `swiftformat` command-line tool is included in the `CommandLineTool` folder. You can either use that, or build it yourself from source. To build it yourself, open `SwiftFormat.xcodeproj` and build the `SwiftFormat (Application)` scheme.
|
||||
1. open `SwiftFormat.xcodeproj` and build the `SwiftFormat (Application)` scheme.
|
||||
|
||||
2. Drag the `swiftformat` binary into `/usr/local/bin/` (this is a hidden folder, but you can use the Finder's `Go > Go to Folder...` menu to open it).
|
||||
|
||||
@@ -75,11 +71,11 @@ To use it safely, do the following:
|
||||
|
||||
3. (Optional) In Terminal, type `swiftformat --inferoptions "/path/to/your/code/"`. This will suggest a set of formatting options to use that match your existing project style (but you are free to ignore these and use the defaults, or your own settings if you prefer).
|
||||
|
||||
The path can point to either a single Swift file, or a directory of files. It can be either be absolute, or relative to the current directory. The `""` quotes around the path are optional, but if the path contains spaces then you either need to use quotes, or escape each space with `\`.
|
||||
The path can point to either a single Swift file, or a directory of files. It can be either be absolute, or relative to the current directory. The `""` quotes around the path are optional, but if the path contains spaces then you either need to use quotes, or escape each space with `\`.
|
||||
|
||||
4. In Terminal, type `swiftformat "/path/to/your/code/"`. The same rules apply as above with respect to path formatting, but you can enter multiple paths if you wish, separated by spaces.
|
||||
|
||||
If you used `--inferoptions` to generate a suggested set of options in step 3, you should copy and paste them into the command, either before or after the path(s) to your source files.
|
||||
If you used `--inferoptions` to generate a suggested set of options in step 3, you should copy and paste them into the command, either before or after the path(s) to your source files.
|
||||
|
||||
5. Press enter to begin formatting. Once the formatting is complete, use your source control system to check the changes, and verify that no undesirable changes have been introduced. If they have, revert the changes, tweak the options and try again.
|
||||
|
||||
@@ -156,44 +152,44 @@ Here are all the rules that SwiftFormat currently applies:
|
||||
init (foo) --> init(foo)
|
||||
|
||||
switch(x){ --> switch (x) {
|
||||
|
||||
|
||||
*spaceInsideParens* - removes the space inside ( ). For example:
|
||||
|
||||
( a, b ) --> (a, b)
|
||||
|
||||
( a, b ) --> (a, b)
|
||||
|
||||
*spaceAroundBrackets* - contextually adjusts the space around [ ]. For example:
|
||||
|
||||
foo as[String] --> foo as [String]
|
||||
|
||||
foo = bar [5] --> foo = bar[5]
|
||||
foo as[String] --> foo as [String]
|
||||
|
||||
foo = bar [5] --> foo = bar[5]
|
||||
|
||||
*spaceInsideBrackets* - removes the space inside [ ]. For example:
|
||||
|
||||
[ 1, 2, 3 ] --> [1, 2, 3]
|
||||
[ 1, 2, 3 ] --> [1, 2, 3]
|
||||
|
||||
*spaceAroundBraces* - contextually adds space around { }. For example:
|
||||
|
||||
foo.filter{ return true }.map{ $0 } --> foo.filter { return true }.map { $0 }
|
||||
|
||||
foo({}) --> foo({})
|
||||
foo.filter{ return true }.map{ $0 } --> foo.filter { return true }.map { $0 }
|
||||
|
||||
foo({}) --> foo({})
|
||||
|
||||
*spaceInsideBraces* - adds space inside { }. For example:
|
||||
|
||||
foo.filter {return true} --> foo.filter { return true }
|
||||
foo.filter {return true} --> foo.filter { return true }
|
||||
|
||||
*spaceAroundGenerics* - removes the space around < >. For example:
|
||||
|
||||
Foo <Bar> () --> Foo<Bar>()
|
||||
Foo <Bar> () --> Foo<Bar>()
|
||||
|
||||
*spaceInsideGenerics* - removes the space inside < >. For example:
|
||||
|
||||
Foo< Bar, Baz > --> Foo<Bar, Baz>
|
||||
Foo< Bar, Baz > --> Foo<Bar, Baz>
|
||||
|
||||
*spaceAroundOperators* - contextually adjusts the space around infix operators:
|
||||
|
||||
foo . bar() --> foo.bar()
|
||||
|
||||
a+b+c --> a + b + c
|
||||
foo . bar() --> foo.bar()
|
||||
|
||||
a+b+c --> a + b + c
|
||||
|
||||
*spaceAroundComments* - adds space around /* ... */ comments and before // comments:
|
||||
|
||||
@@ -203,7 +199,7 @@ Here are all the rules that SwiftFormat currently applies:
|
||||
|
||||
*spaceInsideComments* - adds space inside /* ... */ comments and at the start of // comments:
|
||||
|
||||
let a = 5 //assignment --> let a = 5 // assignment
|
||||
let a = 5 //assignment --> let a = 5 // assignment
|
||||
|
||||
func foo() { /*no-op*/ } --> func foo() { /* no-op */ }
|
||||
|
||||
@@ -229,8 +225,8 @@ Here are all the rules that SwiftFormat currently applies:
|
||||
]
|
||||
]
|
||||
|
||||
if x { if x {
|
||||
print("x") print("x")
|
||||
if x { if x {
|
||||
print("x") print("x")
|
||||
|
||||
} else if y { --> } else if y {
|
||||
print("y") print("y")
|
||||
@@ -239,17 +235,17 @@ Here are all the rules that SwiftFormat currently applies:
|
||||
|
||||
*blankLinesBetweenScopes* - adds a blank line before each class, struct, enum, extension, protocol or function:
|
||||
|
||||
func foo() { func foo() {
|
||||
func foo() { func foo() {
|
||||
//foo //foo
|
||||
} }
|
||||
func bar() {
|
||||
func bar() {
|
||||
//bar --> func bar() {
|
||||
} //bar
|
||||
var baz: Bool }
|
||||
var quux: Int
|
||||
var baz: Bool
|
||||
var quux: Int
|
||||
|
||||
var quux: Int
|
||||
|
||||
*linebreakAtEndOfFile* - ensures that the last line of the file is empty
|
||||
|
||||
*indent* - adjusts leading whitespace based on scope and line wrapping:
|
||||
@@ -271,10 +267,10 @@ Here are all the rules that SwiftFormat currently applies:
|
||||
if x if x {
|
||||
{ //foo
|
||||
//foo }
|
||||
} --> else {
|
||||
} --> else {
|
||||
else //bar
|
||||
{ }
|
||||
//bar
|
||||
//bar
|
||||
}
|
||||
|
||||
*elseOnSameLine* - controls whether an `else`, `catch` or `while` after a `}` appears on the same line:
|
||||
@@ -310,13 +306,13 @@ Here are all the rules that SwiftFormat currently applies:
|
||||
|
||||
*void* - standardizes the use of `Void` vs an empty tuple `()` to represent empty argument lists and return values:
|
||||
|
||||
let foo: () -> () --> let foo: () -> Void
|
||||
|
||||
let bar: Void -> Void --> let bar: () -> Void
|
||||
|
||||
let baz: (Void) -> Void --> let baz: () -> Void
|
||||
|
||||
func quux() -> (Void) --> func quux() -> Void
|
||||
let foo: () -> () --> let foo: () -> Void
|
||||
|
||||
let bar: Void -> Void --> let bar: () -> Void
|
||||
|
||||
let baz: (Void) -> Void --> let baz: () -> Void
|
||||
|
||||
func quux() -> (Void) --> func quux() -> Void
|
||||
|
||||
*todos* - ensures that `TODO:`, `MARK:` and `FIXME:` comments include the trailing colon (else they're ignored by Xcode)
|
||||
|
||||
@@ -331,7 +327,7 @@ Here are all the rules that SwiftFormat currently applies:
|
||||
let foo = 5; let bar = 6 --> let foo = 5
|
||||
let bar = 6
|
||||
|
||||
return; --> return;
|
||||
return; --> return;
|
||||
goto(fail) goto(fail)
|
||||
|
||||
*linebreaks* - normalizes all linebreaks to use the same character, as specified in options (either CR, LF or CRLF).
|
||||
@@ -346,24 +342,38 @@ Here are all the rules that SwiftFormat currently applies:
|
||||
|
||||
*redundantParens* - removes unnecessary parens from around `if`, `while` or `switch` conditions:
|
||||
|
||||
if (foo == true) {} --> if foo == true {}
|
||||
|
||||
while (i < bar.count) {} --> while i < bar.count {}
|
||||
|
||||
if (foo == true) {} --> if foo == true {}
|
||||
|
||||
while (i < bar.count) {} --> while i < bar.count {}
|
||||
|
||||
*redundantGet* - removes unnecessary `get { }`clause from inside read-only computed properties:
|
||||
|
||||
var foo: Int { var foo: Int {
|
||||
get { return 5
|
||||
return 5 --> }
|
||||
}
|
||||
}
|
||||
|
||||
var foo: Int { var foo: Int {
|
||||
get { return 5
|
||||
return 5 --> }
|
||||
}
|
||||
}
|
||||
|
||||
*hexLiterals* - converts all hex literals to upper- or lower-case, depending on settings:
|
||||
|
||||
let color = 0xFF77A5 --> let color = 0xff77a5
|
||||
|
||||
|
||||
*stripHeaders* - removes the comment header blocks that Xcode adds to the top of each file (off by default).
|
||||
|
||||
*wrapArguments* - wraps function arguments and array elements depending on the mode specified. E.g. for `beforeFirst`:
|
||||
|
||||
func foo(bar: Int, func foo(
|
||||
baz: String) { bar: Int,
|
||||
... --> baz: String
|
||||
} ) {
|
||||
...
|
||||
}
|
||||
|
||||
let foo = [bar, let foo = [
|
||||
baz, --> bar,
|
||||
quux] baz,
|
||||
quux
|
||||
]
|
||||
|
||||
FAQ
|
||||
-----
|
||||
@@ -444,53 +454,53 @@ Known issues
|
||||
|
||||
* The formatted file cache is based on file length, so it's possible (though unlikely) that an edited file will have the exact same character count as the previously formatted version, causing SwiftFormat to incorrectly identify it as not having changed, and fail to format it.
|
||||
|
||||
To fix this, you can type an extra space in the file (which SwiftFormat will then remove again when it applies the formatting).
|
||||
|
||||
Alternatively, use the command line option `--cache ignore` to force SwiftFormat to ignore the cache for this run.
|
||||
To fix this, you can type an extra space in the file (which SwiftFormat will then remove again when it applies the formatting).
|
||||
|
||||
Alternatively, use the command line option `--cache ignore` to force SwiftFormat to ignore the cache for this run.
|
||||
|
||||
* If a file begins with a comment, the `stripHeaders` rule will remove it if is followed by a blank line. To avoid this, make sure that the first comment is directly followed by a line of code.
|
||||
|
||||
* SwiftFormat currently reformats multiline comment blocks without regard for the original indenting. That means
|
||||
|
||||
/* some documentation
|
||||
|
||||
func codeExample() {
|
||||
print("Hello World")
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
Will become
|
||||
|
||||
/* some documentation
|
||||
|
||||
func codeExample() {
|
||||
print("Hello World")
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
To work around that, you can disable automatic indenting of comments using the `comments` command line flag.
|
||||
|
||||
Alternatively, if you prefer to leave the comment indenting feature enabled, you can rewrite your multiline comment as a block of single-line comments...
|
||||
|
||||
// some documentation
|
||||
//
|
||||
// func codeExample() {
|
||||
// print("Hello World")
|
||||
// }
|
||||
//
|
||||
//
|
||||
|
||||
Or begin each line with a `*` (or any other non-whitespace character)
|
||||
|
||||
/* some documentation
|
||||
*
|
||||
* func codeExample() {
|
||||
* print("Hello World")
|
||||
* }
|
||||
*
|
||||
*/
|
||||
/* some documentation
|
||||
|
||||
func codeExample() {
|
||||
print("Hello World")
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
Will become
|
||||
|
||||
/* some documentation
|
||||
|
||||
func codeExample() {
|
||||
print("Hello World")
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
To work around that, you can disable automatic indenting of comments using the `comments` command line flag.
|
||||
|
||||
Alternatively, if you prefer to leave the comment indenting feature enabled, you can rewrite your multiline comment as a block of single-line comments...
|
||||
|
||||
// some documentation
|
||||
//
|
||||
// func codeExample() {
|
||||
// print("Hello World")
|
||||
// }
|
||||
//
|
||||
//
|
||||
|
||||
Or begin each line with a `*` (or any other non-whitespace character)
|
||||
|
||||
/* some documentation
|
||||
*
|
||||
* func codeExample() {
|
||||
* print("Hello World")
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
Credits
|
||||
@@ -498,6 +508,7 @@ Credits
|
||||
|
||||
* @tonyarnold - Xcode Source Editor Extension
|
||||
* @bourvill - Git pre-commit hook script
|
||||
* @palleas - Homebrew formula
|
||||
* @nicklockwood - Everything else
|
||||
|
||||
([Full list of contributors](https://github.com/nicklockwood/SwiftFormat/graphs/contributors))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "SwiftFormat",
|
||||
"version": "0.18",
|
||||
"version": "0.19",
|
||||
"license": {
|
||||
"type": "zlib",
|
||||
"file": "LICENCE.md"
|
||||
@@ -10,7 +10,7 @@
|
||||
"authors": "Nick Lockwood",
|
||||
"source": {
|
||||
"git": "https://github.com/nicklockwood/SwiftFormat.git",
|
||||
"tag": "0.18"
|
||||
"tag": "0.19"
|
||||
},
|
||||
"source_files": "SwiftFormat",
|
||||
"requires_arc": true,
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
buildConfiguration = "Release"
|
||||
selectedDebuggerIdentifier = ""
|
||||
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
|
||||
launchStyle = "0"
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
buildConfiguration = "Release"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Formatter.swift
|
||||
// SwiftFormat
|
||||
//
|
||||
// Version 0.18
|
||||
// Version 0.19
|
||||
//
|
||||
// Created by Nick Lockwood on 12/08/2016.
|
||||
// Copyright 2016 Nick Lockwood
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.18</string>
|
||||
<string>0.19</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Rules.swift
|
||||
// SwiftFormat
|
||||
//
|
||||
// Version 0.18
|
||||
// Version 0.19
|
||||
//
|
||||
// Created by Nick Lockwood on 21/10/2016.
|
||||
// Copyright 2016 Nick Lockwood
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Rules.swift
|
||||
// SwiftFormat
|
||||
//
|
||||
// Version 0.18
|
||||
// Version 0.19
|
||||
//
|
||||
// Created by Nick Lockwood on 12/08/2016.
|
||||
// Copyright 2016 Nick Lockwood
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SwiftFormat.h
|
||||
// SwiftFormat
|
||||
//
|
||||
// Version 0.18
|
||||
// Version 0.19
|
||||
//
|
||||
// Created by Nick Lockwood on 12/08/2016.
|
||||
// Copyright 2016 Nick Lockwood
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SwiftFormat.swift
|
||||
// SwiftFormat
|
||||
//
|
||||
// Version 0.18
|
||||
// Version 0.19
|
||||
//
|
||||
// Created by Nick Lockwood on 12/08/2016.
|
||||
// Copyright 2016 Nick Lockwood
|
||||
@@ -34,7 +34,7 @@
|
||||
import Foundation
|
||||
|
||||
/// The current SwiftFormat version
|
||||
public let version = "0.18"
|
||||
public let version = "0.19"
|
||||
|
||||
/// Errors
|
||||
public enum FormatError: Error, CustomStringConvertible {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Tokenizer.swift
|
||||
// SwiftFormat
|
||||
//
|
||||
// Version 0.18
|
||||
// Version 0.19
|
||||
//
|
||||
// Created by Nick Lockwood on 11/08/2016.
|
||||
// Copyright 2016 Nick Lockwood
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.18</string>
|
||||
<string>0.19</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
Reference in New Issue
Block a user