branch: elpa/swift-mode commit 4ae6cc2e4ffebce9070f0fa96dacc8ecf7661e92 Author: uk-ar <yuuki....@gmail.com> Commit: uk-ar <yuuki....@gmail.com>
Fix indent when after comment --- swift-mode.el | 5 ++++- test/indentation-tests.el | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/swift-mode.el b/swift-mode.el index bceab2a..2f61945 100644 --- a/swift-mode.el +++ b/swift-mode.el @@ -225,7 +225,10 @@ (looking-at "[ \n\t]+[.?:]") ;; Operators placed on the second line in multi-line expression ;; Should respect here possible comments strict before the linebreak - (looking-at (concat "\\(\/\/.*\\)?\n[[:space:]]*" swift-smie--operators-regexp)) + (and (looking-at + (concat "\\(\/\/.*\\)?\n[[:space:]]*" swift-smie--operators-regexp)) + (not (looking-at + (concat "\\(\/\/.*\\)?\n[[:space:]]*" "//")))) (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 8be3235..1226198 100644 --- a/test/indentation-tests.el +++ b/test/indentation-tests.el @@ -2009,6 +2009,21 @@ func foo() { } ") +(check-indentation indents-expression-with-comment/3 + " +func foo() { + foo() + // + |foo() +} +" " +func foo() { + foo() + // + |foo() +} +") + (provide 'indentation-tests) ;;; indentation-tests.el ends here