branch: elpa/swift-mode commit 835c3d3f524325789256d9abfde9152be277a073 Merge: abd6e07 2593659 Author: Bozhidar Batsov <bozhidar.bat...@gmail.com> Commit: Bozhidar Batsov <bozhidar.bat...@gmail.com>
Merge pull request #40 from ap4y/improve_37 Improve indentation for multi-line dot expression with dot positioned on the second line --- swift-mode.el | 2 +- test/indentation-tests.el | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/swift-mode.el b/swift-mode.el index bc96468..adea3e9 100644 --- a/swift-mode.el +++ b/swift-mode.el @@ -187,7 +187,7 @@ (defun swift-smie--implicit-semi-p () (save-excursion (not (or (memq (char-before) '(?\{ ?\[ ?, ?.)) - (memq (char-after (+(point) 1)) '(?.)) + (looking-at "[ \n\t]+[.]") (looking-back swift-smie--operators-regexp (- (point) 3) t) )))) diff --git a/test/indentation-tests.el b/test/indentation-tests.el index 3b1c14f..d5dc4b4 100644 --- a/test/indentation-tests.el +++ b/test/indentation-tests.el @@ -792,6 +792,24 @@ let json_ary = NSJSONSerialization |.JSONObjectWithData(data, options: nil, error: &json_err) as NSArray ") +(check-indentation indents-multiline-expressions/6 + " +let json_ary = NSJSONSerialization. + |JSONObjectWithData(data, options: nil, error: &json_err) as NSArray +" " +let json_ary = NSJSONSerialization. + |JSONObjectWithData(data, options: nil, error: &json_err) as NSArray +") + +(check-indentation indents-multiline-expressions/7 + " +let json_ary = NSJSONSerialization + |.JSONObjectWithData(data, options: nil, error: &json_err) as NSArray +" " +let json_ary = NSJSONSerialization + |.JSONObjectWithData(data, options: nil, error: &json_err) as NSArray +") + (check-indentation indents-type-annotations/1 " typealias Foo = Bar<Foo.Baz, Foo>