branch: elpa/swift-mode commit 38933b908780f7941b53bedf40476f6c017898d2 Author: ap4y <l...@pisem.net> Commit: ap4y <l...@pisem.net>
Don't use implicit semicolon when operator is placed on the second line of multiline expression --- swift-mode.el | 4 +++- test/indentation-tests.el | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/swift-mode.el b/swift-mode.el index 96a0b37..2bedbd9 100644 --- a/swift-mode.el +++ b/swift-mode.el @@ -218,8 +218,10 @@ (looking-back "[[:space:]][?!]" (- (point) 2) t) ;; ??, is? and as? are operators (looking-back "[?][?]\\|as[?]\\|is[?]" (- (point) 3) t) - ;; Leding character in multi-line expression + ;; Characters placed on the second line in multi-line expression (looking-at "[ \n\t]+[.?:]") + ;; Operators placed on the second line in multi-line expression + (looking-at (concat "[ \n\t]+" swift-smie--operators-regexp)) (and (looking-back swift-smie--operators-regexp (- (point) 3) t) ;; Not a generic type (not (looking-back "[[:upper:]]>" (- (point) 2) t))) diff --git a/test/indentation-tests.el b/test/indentation-tests.el index f5abdfd..9a63dfb 100644 --- a/test/indentation-tests.el +++ b/test/indentation-tests.el @@ -1156,6 +1156,15 @@ CGPoint(x: aaaaaaaaaaaaaaa.x + bbbbbbbbbbbbbbbb) ") +(check-indentation indents-multiline-expressions/19 + " +let x = 1 +|+ 1 +" " +let x = 1 + |+ 1 +") + (check-indentation indents-multiline-expressions/20 " let x = foo ?? @@ -1275,7 +1284,7 @@ let foo = bar > " " 1 + 2 + 5 * - |3 + |3 " )