branch: elpa/swift-mode commit 4a274772b3073fa12f7d330ea55329d5bfa44694 Merge: 195d040 655bd60 Author: Arthur Evstifeev <m...@ap4y.me> Commit: Arthur Evstifeev <m...@ap4y.me>
Merge pull request #89 from uk-ar/fix-indent-in-trailing-closure Fix indent in trailing closure --- 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 bceab2a..ae5485f 100644 --- a/swift-mode.el +++ b/swift-mode.el @@ -375,7 +375,8 @@ ;; "in" token in closure (`(:after . "in") (if (smie-rule-parent-p "{") - (smie-rule-parent swift-indent-offset))) + (smie-rule-parent swift-indent-offset) + (smie-rule-parent 0))) (`(:after . "(") (if (smie-rule-parent-p "(") 0 diff --git a/test/indentation-tests.el b/test/indentation-tests.el index 8be3235..e621d8c 100644 --- a/test/indentation-tests.el +++ b/test/indentation-tests.el @@ -1947,6 +1947,32 @@ foo.bar(10, ) ") +(check-indentation trailing-closure/1 + " +a(){ + (b: String, c:String) -> String in + |println(c) +} +" " +a(){ + (b: String, c:String) -> String in + |println(c) +} +") + +(check-indentation trailing-closure/2 + " +a(){ + b,c in + |println(c) +} +" " +a(){ + b,c in + |println(c) +} +") + (check-indentation indents-expression-with-optional-type/1 " var object: JsonObject?