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

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

[nongnu] elpa/swift-mode d0c65bc 212/496: Fix bug with the closing paren


From: ELPA Syncer
Subject: [nongnu] elpa/swift-mode d0c65bc 212/496: Fix bug with the closing parentheses in method calls and function
Date: Sun, 29 Aug 2021 11:33:38 -0400 (EDT)

branch: elpa/swift-mode
commit d0c65bc50dc45b3031e216aa4352899b8f05a844
Author: ap4y <lod@pisem.net>
Commit: ap4y <lod@pisem.net>

    Fix bug with the closing parentheses in method calls and function
    declarations with multi-line arguments
---
 swift-mode.el             |  6 +++---
 test/indentation-tests.el | 23 +++++++++++++++++++++++
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/swift-mode.el b/swift-mode.el
index 6d6776c..9e4408f 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -366,10 +366,12 @@
     (`(:after . ,(or `"func" `"class")) (smie-rule-parent 0))
 
     (`(:after . "(") (smie-rule-parent swift-indent-offset))
+
     (`(:before . "(")
      (cond
       ((smie-rule-next-p "[") (smie-rule-parent))
-      ((smie-rule-parent-p ".") 0)))
+      ;; Custom indentation for method arguments
+      ((smie-rule-parent-p "." "func") (smie-rule-parent 0))))
 
     (`(:before . "[")
      (cond
@@ -377,8 +379,6 @@
       ((smie-rule-parent-p "[") swift-indent-offset)
       (t (smie-rule-parent))))
     (`(:after . "->") (smie-rule-parent swift-indent-offset))
-
-    (`(:close-all . "}") (if (smie-rule-parent-p "(") 't))
     ))
 
 ;;; Font lock
diff --git a/test/indentation-tests.el b/test/indentation-tests.el
index 56ffafd..d3ec032 100644
--- a/test/indentation-tests.el
+++ b/test/indentation-tests.el
@@ -1262,6 +1262,29 @@ func a(
 }
 ")
 
+(check-indentation indents-long-parameters/5
+                   "
+func foo() {
+    timer = NSTimer.scheduledTimerWithTimeInterval(
+                1.0,
+                target: self,
+                selector: Selector(\"onTimer\"),
+                userInfo: nil,
+                repeats: true
+|)
+}
+" "
+func foo() {
+    timer = NSTimer.scheduledTimerWithTimeInterval(
+                1.0,
+                target: self,
+                selector: Selector(\"onTimer\"),
+                userInfo: nil,
+                repeats: true
+            |)
+}
+")
+
 (check-indentation indents-multiline-expressions-to-user-defined-offset/1
                    "
 NSNotificationCenter.defaultCenter()



reply via email to

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