branch: elpa/swift-mode commit ebc60c89affb40c2cb17dcaa5860da05de8d527c Author: ap4y <l...@pisem.net> Commit: ap4y <l...@pisem.net>
Make closure block in function argument close at the offset 0 --- swift-mode.el | 2 ++ test/indentation-tests.el | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/swift-mode.el b/swift-mode.el index 8238521..c2f2150 100644 --- a/swift-mode.el +++ b/swift-mode.el @@ -356,6 +356,8 @@ ((smie-rule-parent-p "[") swift-indent-offset) (t (smie-rule-parent)))) (`(:after . "->") (smie-rule-parent swift-indent-offset)) + + (`(:close-all . "}") (if (smie-rule-parent-p "(") 't)) )) ;;; Font lock diff --git a/test/indentation-tests.el b/test/indentation-tests.el index e3f91e7..1a9af87 100644 --- a/test/indentation-tests.el +++ b/test/indentation-tests.el @@ -1325,6 +1325,30 @@ if a { } ") +(check-indentation anonymous-function-as-a-argument/1 + " +UIView.animateWithDuration(1.0, + animations: { +|}) +" " +UIView.animateWithDuration(1.0, + animations: { +|}) +") + +(check-indentation anonymous-function-as-a-argument/2 + " +UIView.animateWithDuration( + 1.0, + animations: { +|}) +" " +UIView.animateWithDuration( + 1.0, + animations: { +|}) +") + (provide 'indentation-tests) ;;; indentation-tests.el ends here