branch: elpa/swift-mode commit cf219aacdc090b98ec081672ad2d7b87b91c2339 Author: ap4y <l...@pisem.net> Commit: ap4y <l...@pisem.net>
Improve indentation of the nested arrays and dictionaries --- swift-mode.el | 2 +- test/indentation-tests.el | 54 +++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/swift-mode.el b/swift-mode.el index 41b7689..2c7178d 100644 --- a/swift-mode.el +++ b/swift-mode.el @@ -376,7 +376,7 @@ (`(:before . "[") (cond ((smie-rule-prev-p "->") swift-indent-offset) - ((smie-rule-parent-p "[") swift-indent-offset) + ((smie-rule-parent-p "[") (smie-rule-parent swift-indent-offset)) (t (smie-rule-parent)))) (`(:after . "->") (smie-rule-parent swift-indent-offset)) )) diff --git a/test/indentation-tests.el b/test/indentation-tests.el index 3bb1623..0aea214 100644 --- a/test/indentation-tests.el +++ b/test/indentation-tests.el @@ -709,15 +709,6 @@ class Foo: Bar<A, B, |C> ") -(check-indentation indents-class-declaration/8 - " -class Foo: Bar<A, B, -|[C]> -" " -class Foo: Bar<A, B, - |[C]> -") - (check-indentation indents-class-declaration/9 " class Foo<A: B<C>>: @@ -1022,6 +1013,51 @@ let foo = [ |[ ") +(check-indentation indents-declaration/13 + " +let foo = [ +|[ + bar: baz + ] +] +" " +let foo = [ + |[ + bar: baz + ] +] +") + +(check-indentation indents-declaration/14 + " +let foo = [ + [ + |bar: baz + ] +] +" " +let foo = [ + [ + |bar: baz + ] +] +") + +(check-indentation indents-declaration/15 + " +let foo = [ + [ + bar: baz +|] +] +" " +let foo = [ + [ + bar: baz + |] +] +") + (check-indentation indents-multiline-expressions/1 " Foo.bar([foo: bar,