branch: elpa/swift-mode commit a60e3fa5fa87ccbbd8fa91ed0a4ef049941b9b12 Author: ap4y <l...@pisem.net> Commit: ap4y <l...@pisem.net>
Don't indent chain of operators multiple times --- swift-mode.el | 3 ++- test/indentation-tests.el | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/swift-mode.el b/swift-mode.el index 2bedbd9..1666781 100644 --- a/swift-mode.el +++ b/swift-mode.el @@ -344,7 +344,8 @@ ;; Apply swift-indent-multiline-statement-offset if ;; operator is the last symbol on the line (`(:before . "OP") - (when (smie-rule-hanging-p) + (when (and (smie-rule-hanging-p) + (not (smie-rule-parent-p "OP"))) (if (smie-rule-parent-p "{") (+ swift-indent-offset swift-indent-multiline-statement-offset) swift-indent-multiline-statement-offset))) diff --git a/test/indentation-tests.el b/test/indentation-tests.el index 9a63dfb..0b881f9 100644 --- a/test/indentation-tests.el +++ b/test/indentation-tests.el @@ -1174,6 +1174,32 @@ let x = foo ?? |bar ") +(check-indentation indents-multiline-expressions/21 + " +let foo = a + + b + + |c + + d +" " +let foo = a + + b + + |c + + d +") + +(check-indentation indents-multiline-expressions/22 + " +let foo = a + + b + + c + + |d +" " +let foo = a + + b + + c + + |d +") + (check-indentation indents-long-parameters/1 " func foo() {