Skip to content

Commit be8d770

Browse files
committed
Fix indentation after `class' modifier
1 parent 922dc52 commit be8d770

File tree

2 files changed

+62
-6
lines changed

2 files changed

+62
-6
lines changed

swift-mode-lexer.el

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,12 @@ Return nil otherwise." ;; FIXME pound-count
463463
"fileprivate")))))
464464
nil)
465465

466+
;; Suppress implicit semicolon after declaration starters.
467+
((member (swift-mode:token:text previous-token)
468+
'("class" "struct" "protocol" "enum" "extension" "func"
469+
"typealias" "associatedtype" "precedencegroup" "operator"))
470+
nil)
471+
466472
;; Insert implicit semicolon before modifiers.
467473
;;
468474
;; Preceding modifiers takes precedence over this.
@@ -525,12 +531,6 @@ Return nil otherwise." ;; FIXME pound-count
525531
'("get" "set" "willSet" "didSet" "subscript" "init" "deinit"))
526532
t)
527533

528-
;; Suppress implicit semicolon after declaration starters.
529-
((member (swift-mode:token:text previous-token)
530-
'("class" "struct" "protocol" "enum" "extension" "func"
531-
"typealias" "associatedtype" "precedencegroup" "operator"))
532-
nil)
533-
534534
;; Inserts implicit semicolon before declaration starters.
535535
;; Modifiers take precedence over this.
536536
;;

test/swift-files/indent/declarations.swift

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,3 +460,59 @@ precedencegroup
460460
associativity:
461461
left
462462
}
463+
464+
// Declaration modifiers
465+
466+
class Foo {
467+
open
468+
class
469+
mutating
470+
nonmutating
471+
func
472+
foo() {
473+
}
474+
475+
public
476+
(
477+
set
478+
)
479+
class
480+
dynamic
481+
final
482+
lazy
483+
optional
484+
required
485+
static
486+
unowned
487+
unowned
488+
(
489+
safe
490+
)
491+
unowned
492+
(
493+
unsafe
494+
)
495+
weak
496+
var
497+
x = 1
498+
499+
internal
500+
class
501+
let
502+
x = 1
503+
504+
fileprivate
505+
class
506+
init() {
507+
}
508+
509+
private
510+
class
511+
deinit {
512+
}
513+
514+
class
515+
subscript(foo: Int) -> Int {
516+
return foo
517+
}
518+
}

0 commit comments

Comments
 (0)