branch: elpa/swift-mode commit 0c734dd99901613c653684e34bf529d8574591fd Author: ap4y <l...@pisem.net> Commit: ap4y <l...@pisem.net>
Indent multiline hash and array syntax same way as Xcode does --- swift-mode.el | 4 ++++ test/indentation-tests.el | 23 +++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/swift-mode.el b/swift-mode.el index ac810cd..d094cbf 100644 --- a/swift-mode.el +++ b/swift-mode.el @@ -239,6 +239,10 @@ (if (smie-rule-parent-p "{") swift-indent-offset (smie-rule-parent)))) + + (`(:before . "(") + (if (smie-rule-next-p "[") (smie-rule-parent))) + (`(:before . "[") (smie-rule-parent)) )) ;;; Font lock diff --git a/test/indentation-tests.el b/test/indentation-tests.el index 4c9152a..3d35adf 100644 --- a/test/indentation-tests.el +++ b/test/indentation-tests.el @@ -694,11 +694,11 @@ let foo = [foo: bar, bar: baz] " let foo = [ |bar: baz - ] +] " " let foo = [ - |bar: baz - ] + |bar: baz +] ") (check-indentation indents-declaration/5 @@ -714,11 +714,11 @@ let foo = [foo, bar] " let foo = [ |bar - ] +] " " let foo = [ - |bar - ] + |bar +] ") (check-indentation indents-declaration/7 @@ -730,6 +730,17 @@ var result = Dictionary<String, V>() |foo ") +(check-indentation indents-multiline-expressions/1 +" +Foo.bar([ +|bar: baz +]) +" " +Foo.bar([ + |bar: baz +]) +") + (check-indentation indents-type-annotations/1 " typealias Foo = Bar<Foo.Baz, Foo>