You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-9Lines changed: 13 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Major-mode for Apple's [Swift programming language](https://developer.apple.com/
11
11
12
12
Install `swift-mode` package from MELPA.
13
13
14
-
To install without MELPA, download [latest release](https://github.com/swift-emacs/swift-mode/releases) and execute `M-x package-install-file`.
14
+
To install without MELPA, download [latest release](https://github.com/swift-emacs/swift-mode/releases) and execute `M-x package-install-file` for the .tar archive.
15
15
16
16
## Features
17
17
@@ -91,19 +91,19 @@ Some syntax constructs removed from Swift 3.0 are not supported:
91
91
}
92
92
```
93
93
94
-
Indentation may not accurate. For example, `foo(Bar < A, B > (c))`is indented like either
94
+
Indentation may not accurate. For example, `foo(Bar < A, B > (c))`can be indented like either
95
95
```swift
96
96
foo(Bar < A,
97
97
B > (c)) // Passing two Boolean arguments to foo
98
98
```
99
99
or
100
100
```swift
101
101
foo(Bar < A,
102
-
B > (c)) //constructing Bar with two type arguments and a value
102
+
B > (c)) //Passing a new Bar with two type arguments and a value
103
103
```
104
104
The Swift compiler disambiguates this case using tokens after `>`, but those tokens may not available at editing time. We use some heuristic for this.
105
105
106
-
Another example is difficulty of handling of colons. We have to pair all `?` and `:` of conditional operators to decide indentation. This is a future work.
106
+
Another example is difficulty of handling of colons. We have to pair all `?` and `:` of conditional operators to decide indentation of the below snippet. This is a future work.
107
107
108
108
```swift
109
109
switch foo {
@@ -128,7 +128,7 @@ var x = foo
128
128
}
129
129
```
130
130
131
-
while we also want to indent if body like this:
131
+
while we also want to indent the body of `if` like this:
132
132
133
133
```swift
134
134
if anotherVeryLongVariableName
@@ -137,7 +137,9 @@ if anotherVeryLongVariableName
137
137
}
138
138
```
139
139
140
-
Then, how should we indent this when the cursor is before `@`?
140
+
That is, we have to indent the closing brace with offset if it is a part of expressions while it should be aligned with the beginning of the statement/declaration if it is a part of a statement/declaration.
141
+
142
+
Then, how should we indent the following code when the cursor is before `@`?
141
143
142
144
```swift
143
145
var x = foo
@@ -153,6 +155,7 @@ var x = foo
153
155
aaa
154
156
}
155
157
}
158
+
// property declaration
156
159
```
157
160
or
158
161
```swift
@@ -161,6 +164,7 @@ var x = foo
161
164
@abcvar x =1
162
165
x
163
166
}
167
+
// property initialization
164
168
```
165
169
166
170
Both are syntactically correct code. We cannot handle this case properly. This is also a future work.
@@ -177,9 +181,9 @@ For other commands, run `make help`.
177
181
178
182
## Related projects
179
183
180
-
- [Official swift-mode.el by Apple](https://github.com/apple/swift/blob/master/utils/swift-mode.el) Seems still in very early stage for now. We cannot contribute to it due to the license incompatibility.
181
-
- [company-sourcekit](https://github.com/nathankot/company-sourcekit) Completion for Swift projects via SourceKit with the help of SourceKitten.
182
-
- [flycheck-swift](https://github.com/swift-emacs/flycheck-swift) Flycheck extensions for Swift.
184
+
- [Official swift-mode.el by Apple](https://github.com/apple/swift/blob/master/utils/swift-mode.el): Seems still in very early stage for now. We cannot contribute to it due to the license incompatibility.
185
+
- [company-sourcekit](https://github.com/nathankot/company-sourcekit): Completion for Swift projects via SourceKit with the help of SourceKitten.
186
+
- [flycheck-swift](https://github.com/swift-emacs/flycheck-swift): Flycheck extensions for Swift.
0 commit comments