[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swift-mode 12f25fc9e7 1/2: Fix indentation after async pro
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swift-mode 12f25fc9e7 1/2: Fix indentation after async protocol method |
Date: |
Sat, 22 Jun 2024 07:00:50 -0400 (EDT) |
branch: elpa/swift-mode
commit 12f25fc9e7d82cb03b1ae9c1c7c52fa2ecc03b09
Author: taku0 <mxxouy6x3m_github@tatapa.org>
Commit: taku0 <mxxouy6x3m_github@tatapa.org>
Fix indentation after async protocol method
---
swift-mode-lexer.el | 9 ++++++++-
test/swift-files/indent/declarations.swift | 1 +
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/swift-mode-lexer.el b/swift-mode-lexer.el
index c826ee2166..d82c3813c1 100644
--- a/swift-mode-lexer.el
+++ b/swift-mode-lexer.el
@@ -642,6 +642,13 @@ return non-nil."
(swift-mode:forward-token-simple)))
"let"))
+ ;; After async
+ ;;
+ ;; Suppresses implicit semicolon if before let.
+ ((and (equal (swift-mode:token:text previous-token) "async")
+ (equal (swift-mode:token:text next-token) "let"))
+ nil)
+
;; Suppress implicit semicolon around else
((or
(equal (swift-mode:token:text previous-token) "else")
@@ -721,7 +728,7 @@ return non-nil."
;; Suppress implicit semicolon after keywords that cannot end statements.
((member (swift-mode:token:text previous-token)
'("while" "for" "switch" "case" "default" "catch" "if" "guard"
- "let" "var" "throw" "import" "async"))
+ "let" "var" "throw" "import"))
nil)
;; Inserts implicit semicolon before keywords that starts a new
diff --git a/test/swift-files/indent/declarations.swift
b/test/swift-files/indent/declarations.swift
index abd004c458..266d9cc782 100644
--- a/test/swift-files/indent/declarations.swift
+++ b/test/swift-files/indent/declarations.swift
@@ -698,6 +698,7 @@ protocol Foo {
func foo(x: Int, y: Int) throws -> (A, B)
func bar(x: Int) throws
func baz(x: () throws -> Int) rethrows
+ func aaa() async
init<A, B>(x: Int) throws
where
A: C