10000 Fix indentation after async protocol method · swift-emacs/swift-mode@12f25fc · GitHub
[go: up one dir, main page]

Skip to content

Commit 12f25fc

Browse files
committed
Fix indentation after async protocol method
1 parent 26ca22a commit 12f25fc

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

swift-mode-lexer.el

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,13 @@ return non-nil."
642642
(swift-mode:forward-token-simple)))
643643
"let"))
644644

645+
;; After async
646+
;;
647+
;; Suppresses implicit semicolon if before let.
648+
((and (equal (swift-mode:token:text previous-token) "async")
649+
(equal (swift-mode:token:text next-token) "let"))
650+
nil)
651+
645652
;; Suppress implicit semicolon around else
646653
((or
647654
(equal (swift-mode:token:text previous-token) "else")
@@ -721,7 +728,7 @@ return non-nil."
721728
;; Suppress implicit semicolon after keywords that cannot end statements.
722729
((member (swift-mode:token:text previous-token)
723730
'("while" "for" "switch" "case" "default" "catch" "if" "guard"
724-
"let" "var" "throw" "import" "async"))
731+
"let" "var" "throw" "import"))
9145
725732
nil)
726733

727734
;; Inserts implicit semicolon before keywords that starts a new

test/swift-files/indent/declarations.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ protocol Foo {
698698
func foo(x: Int, y: Int) throws -> (A, B)
699699
func bar(x: Int) throws
700700
func baz(x: () throws -> Int) rethrows
701+
func aaa() async
701702
init<A, B>(x: Int) throws
702703
where
703704
A: C

0 commit comments

Comments
 (0)
0