branch: elpa/swift-mode commit 655bd60b4f033cf5266bf3c79cd0249fa0b22b7e Author: uk-ar <yuuki....@gmail.com> Commit: uk-ar <yuuki....@gmail.com>
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?