branch: elpa/swift-mode commit 4bdbc23932048d34d5a59261233ccd29b4985c9e Author: ap4y <l...@pisem.net> Commit: ap4y <l...@pisem.net>
Normalize indentation for function declration with argument list on the second line --- swift-mode.el | 4 ++++ test/indentation-tests.el | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/swift-mode.el b/swift-mode.el index c8e2d42..6d6776c 100644 --- a/swift-mode.el +++ b/swift-mode.el @@ -361,6 +361,10 @@ swift-indent-offset (smie-rule-parent)))) + ;; Disable unnecessary default indentation for + ;; "func" and "class" keywords + (`(:after . ,(or `"func" `"class")) (smie-rule-parent 0)) + (`(:after . "(") (smie-rule-parent swift-indent-offset)) (`(:before . "(") (cond diff --git a/test/indentation-tests.el b/test/indentation-tests.el index 0b881f9..56ffafd 100644 --- a/test/indentation-tests.el +++ b/test/indentation-tests.el @@ -1232,6 +1232,36 @@ aaaaaa.aaaaaaaaaaaaaaaaaaaaa( ) ") +(check-indentation indents-long-parameters/3 + " +public func tableView( +|tableView: UITableView, + commitEditingStyle editingStyle: UITableViewCellEditingStyle, + forRowAtIndexPath indexPath: NSIndexPath) { +} +" " +public func tableView( + |tableView: UITableView, + commitEditingStyle editingStyle: UITableViewCellEditingStyle, + forRowAtIndexPath indexPath: NSIndexPath) { +} +") + +(check-indentation indents-long-parameters/4 + " +func a( + |a: a, + a: a, + a: a) { +} +" " +func a( + |a: a, + a: a, + a: a) { +} +") + (check-indentation indents-multiline-expressions-to-user-defined-offset/1 " NSNotificationCenter.defaultCenter()