Skip to content

Commit aa49efa

Browse files
committed
Fix indentation of switch.
1 parent f03db1a commit aa49efa

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

swift-mode-lexer.el

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ END is the point after the token."
258258
;; Suppress implicit semicolon after keywords that cannot end statements.
259259
((member (swift-mode:token:text previous-token)
260260
'("while" "for" "switch" "case" "default" "catch" "if" "guard"
261-
"let" "var" "throw" "import" "return"))
261+
"let" "var" "throw" "import"))
262262
nil)
263263

264264
;; Inserts implicit semicolon before keywords that starts a new
@@ -268,6 +268,10 @@ END is the point after the token."
268268
"guard" "let" "var" "throw" "import" "return"))
269269
t)
270270

271+
;; Suppress implicit semicolon after return.
272+
((equal (swift-mode:token:text previous-token) "return")
273+
nil)
274+
271275
;; Inserts implicit semicolon before `while' unless it is part of
272276
;; `repeat...while'.
273277
((equal (swift-mode:token:text next-token) "while")

test/swift-files/statements.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,13 @@ default:
897897
}
898898
}
899899

900+
switch foo {
901+
case 1:
902+
return
903+
case 2:
904+
bar()
905+
}
906+
900907
// swift-mode:test:eval (setq-local swift-mode:switch-case-offset 2)
901908

902909
switch foo {

0 commit comments

Comments
 (0)