[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swift-mode aa49efa 332/496: Fix indentation of switch.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swift-mode aa49efa 332/496: Fix indentation of switch. |
Date: |
Sun, 29 Aug 2021 11:34:01 -0400 (EDT) |
branch: elpa/swift-mode
commit aa49efad76b4a72c0cb6c6a661863eec48aef872
Author: taku0 <mxxouy6x3m_github@tatapa.org>
Commit: taku0 <mxxouy6x3m_github@tatapa.org>
Fix indentation of switch.
---
swift-mode-lexer.el | 6 +++++-
test/swift-files/statements.swift | 7 +++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/swift-mode-lexer.el b/swift-mode-lexer.el
index 97cabb7..4224f1e 100644
--- a/swift-mode-lexer.el
+++ b/swift-mode-lexer.el
@@ -258,7 +258,7 @@ END is the point after the token."
;; 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" "return"))
+ "let" "var" "throw" "import"))
nil)
;; Inserts implicit semicolon before keywords that starts a new
@@ -268,6 +268,10 @@ END is the point after the token."
"guard" "let" "var" "throw" "import" "return"))
t)
+ ;; Suppress implicit semicolon after return.
+ ((equal (swift-mode:token:text previous-token) "return")
+ nil)
+
;; Inserts implicit semicolon before `while' unless it is part of
;; `repeat...while'.
((equal (swift-mode:token:text next-token) "while")
diff --git a/test/swift-files/statements.swift
b/test/swift-files/statements.swift
index 79947ad..f46cd24 100644
--- a/test/swift-files/statements.swift
+++ b/test/swift-files/statements.swift
@@ -897,6 +897,13 @@ default:
}
}
+switch foo {
+case 1:
+ return
+case 2:
+ bar()
+}
+
// swift-mode:test:eval (setq-local swift-mode:switch-case-offset 2)
switch foo {
- [nongnu] elpa/swift-mode 5448098 366/496: Improve functions related to defuns, (continued)
- [nongnu] elpa/swift-mode 5448098 366/496: Improve functions related to defuns, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 7d9aabb 426/496: Improve support for Imenu, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode b4e0622 444/496: Add test for indent of import declarations, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode d266fbd 462/496: Update standard types, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 3bbc38e 469/496: Update copyright notices, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode f88e1ac 491/496: Support actor, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode f614620 493/496: Add tests for effectful read-only properties, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 471d158 490/496: Highlight actor, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 59dcd60 358/496: Fix errors in 24.4, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode c862d2c 438/496: Update test, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode aa49efa 332/496: Fix indentation of switch.,
ELPA Syncer <=
- [nongnu] elpa/swift-mode b9ad000 409/496: Make customs autoloaded, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode fc718a5 415/496: Bump version to 7.0.1, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode bd5b2cb 449/496: Add links to lsp-sourcekit and swift-helpful, ELPA Syncer, 2021/08/29