branch: elpa/swift-mode commit 5e3ab8cd253bc5311475833532342285f3e8c21b Author: ap4y <l...@pisem.net> Commit: ap4y <l...@pisem.net>
Apply swift-indent-multiline-statement-offset to the multi-line statements with hanging operator --- swift-mode.el | 6 ++++++ test/indentation-tests.el | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/swift-mode.el b/swift-mode.el index 4561d38..f16fbe9 100644 --- a/swift-mode.el +++ b/swift-mode.el @@ -280,6 +280,12 @@ (looking-back "[ \t\n]" 1 t)) (smie-rule-parent swift-indent-multiline-statement-offset))) + ;; Apply swift-indent-multiline-statement-offset if + ;; operator is the last symbol on the line + (`(:before . "OP") + (if (looking-at ".[\n]") + (smie-rule-parent swift-indent-multiline-statement-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 fd3d30c..f958732 100644 --- a/test/indentation-tests.el +++ b/test/indentation-tests.el @@ -850,6 +850,16 @@ let json_ary = NSJSONSerialization " ((swift-indent-multiline-statement-offset 4))) +(check-indentation indents-multiline-expressions-to-user-defined-offset/4 + " +let options = NSRegularExpressionOptions.CaseInsensitive & +|NSRegularExpressionOptions.DotMatchesLineSeparators +" " +let options = NSRegularExpressionOptions.CaseInsensitive & + |NSRegularExpressionOptions.DotMatchesLineSeparators +" +((swift-indent-multiline-statement-offset 4))) + (check-indentation indents-type-annotations/1 " typealias Foo = Bar<Foo.Baz, Foo>