Skip to content

Commit 2b2e858

Browse files
nhojbtaku0
authored andcommitted
Fix inner scope guard indent
1 parent 609471e commit 2b2e858

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

swift-mode-indent.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ OFFSET is extra offset if given."
912912
(let ((parent (swift-mode:backward-sexps-until
913913
(append
914914
(remove 'implicit-\; swift-mode:statement-parent-tokens)
915-
'("if")))))
915+
'("if" "guard")))))
916916
(if (equal (swift-mode:token:text parent) "if")
917917
(cond
918918
;; Found "if" at the beginning of a line. Align with it.

test/swift-files/indent/statements.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,14 @@ guard
715715
else {
716716
}
717717

718+
// Inner scope guard
719+
720+
func main() {
721+
guard foo else {
722+
bar()
723+
}
724+
}
725+
718726
// Switch statement
719727

720728
switch foo

0 commit comments

Comments
 (0)