branch: elpa/swift-mode commit 9b6f599bef4f9e0e7430e8da93b3fe6e018934e8 Author: ap4y <l...@pisem.net> Commit: ap4y <l...@pisem.net>
Apply swift-indent-offset to multi-line class definitions --- swift-mode.el | 6 ++++++ test/indentation-tests.el | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/swift-mode.el b/swift-mode.el index 07d9c07..6ea81fa 100644 --- a/swift-mode.el +++ b/swift-mode.el @@ -287,6 +287,12 @@ (if (looking-at ".[\n]") (smie-rule-parent swift-indent-multiline-statement-offset))) + ;; Indent second line of the multi-line class + ;; definitions with swift-indent-offset + (`(:before . ",") + (if (smie-rule-parent-p "class") + swift-indent-offset)) + (`(:before . "if") (if (smie-rule-prev-p "else") (if (smie-rule-parent-p "{") diff --git a/test/indentation-tests.el b/test/indentation-tests.el index f958732..22d659e 100644 --- a/test/indentation-tests.el +++ b/test/indentation-tests.el @@ -620,6 +620,17 @@ class Foo: Bar { } ") +(check-indentation indents-class-declaration/5 + " +class Foo: Foo, Bar, +|Baz { +} +" " +class Foo: Foo, Bar, + |Baz { +} +") + (check-indentation indents-func-declaration/1 " func Foo(a: String) {