branch: elpa/swift-mode
commit be8d7700cdbf47576d7c4e0a7e0855cce0fe9ad8
Author: taku0 <[email protected]>
Commit: taku0 <[email protected]>
Fix indentation after `class' modifier
---
swift-mode-lexer.el | 12 +++----
test/swift-files/indent/declarations.swift | 56 ++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 6 deletions(-)
diff --git a/swift-mode-lexer.el b/swift-mode-lexer.el
index ab93cae..bcda40e 100644
--- a/swift-mode-lexer.el
+++ b/swift-mode-lexer.el
@@ -463,6 +463,12 @@ Return nil otherwise." ;; FIXME pound-count
"fileprivate")))))
nil)
+ ;; Suppress implicit semicolon after declaration starters.
+ ((member (swift-mode:token:text previous-token)
+ '("class" "struct" "protocol" "enum" "extension" "func"
+ "typealias" "associatedtype" "precedencegroup" "operator"))
+ nil)
+
;; Insert implicit semicolon before modifiers.
;;
;; Preceding modifiers takes precedence over this.
@@ -525,12 +531,6 @@ Return nil otherwise." ;; FIXME pound-count
'("get" "set" "willSet" "didSet" "subscript" "init" "deinit"))
t)
- ;; Suppress implicit semicolon after declaration starters.
- ((member (swift-mode:token:text previous-token)
- '("class" "struct" "protocol" "enum" "extension" "func"
- "typealias" "associatedtype" "precedencegroup" "operator"))
- nil)
-
;; Inserts implicit semicolon before declaration starters.
;; Modifiers take precedence over this.
;;
diff --git a/test/swift-files/indent/declarations.swift
b/test/swift-files/indent/declarations.swift
index 7ad7978..469d0f9 100644
--- a/test/swift-files/indent/declarations.swift
+++ b/test/swift-files/indent/declarations.swift
@@ -460,3 +460,59 @@ precedencegroup
associativity:
left
}
+
+// Declaration modifiers
+
+class Foo {
+ open
+ class
+ mutating
+ nonmutating
+ func
+ foo() {
+ }
+
+ public
+ (
+ set
+ )
+ class
+ dynamic
+ final
+ lazy
+ optional
+ required
+ static
+ unowned
+ unowned
+ (
+ safe
+ )
+ unowned
+ (
+ unsafe
+ )
+ weak
+ var
+ x = 1
+
+ internal
+ class
+ let
+ x = 1
+
+ fileprivate
+ class
+ init() {
+ }
+
+ private
+ class
+ deinit {
+ }
+
+ class
+ subscript(foo: Int) -> Int {
+ return foo
+ }
+}