emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/swift-mode e898e7e 234/496: Merge pull request #91 from uk


From: ELPA Syncer
Subject: [nongnu] elpa/swift-mode e898e7e 234/496: Merge pull request #91 from uk-ar/fix-indent-with-hanging-operator-after-comment
Date: Sun, 29 Aug 2021 11:33:42 -0400 (EDT)

branch: elpa/swift-mode
commit e898e7e469478f9bb19ba9f62e62b282001d7dbb
Merge: dbf48a1 a2f5b33
Author: Arthur Evstifeev <mail@ap4y.me>
Commit: Arthur Evstifeev <mail@ap4y.me>

    Merge pull request #91 from 
uk-ar/fix-indent-with-hanging-operator-after-comment
    
    Fix indent when operator hanging after comment
---
 swift-mode.el             |  4 +++-
 test/indentation-tests.el | 17 ++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/swift-mode.el b/swift-mode.el
index 364cb89..586ef5c 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -222,7 +222,9 @@
              ;; "in" operator in closure
              (looking-back "in" (- (point) 2) t)
              ;; Characters placed on the second line in multi-line expression
-             (looking-at "[ \n\t]+[.?:]")
+             (save-excursion
+               (forward-comment (buffer-size))
+               (looking-at "[.?:]"))
              ;; 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))
diff --git a/test/indentation-tests.el b/test/indentation-tests.el
index e621d8c..20367de 100644
--- a/test/indentation-tests.el
+++ b/test/indentation-tests.el
@@ -1607,6 +1607,21 @@ let a = a ?
 
 (check-indentation conditional-operator/8
                    "
+let a = a //foo
+        |? a +
+          1
+        : a +
+          1
+" "
+let a = a //foo
+        |? a +
+          1
+        : a +
+          1
+")
+
+(check-indentation conditional-operator/9
+                   "
 func foo() {
     return order!.deliver ?
          |OrderViewTableDeliveryCells.lastCellIndex.rawValue :
@@ -1620,7 +1635,7 @@ func foo() {
 }
 ")
 
-(check-indentation conditional-operator/9
+(check-indentation conditional-operator/10
                    "
 func foo() {
     return order!.deliver ?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]