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

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

[nongnu] elpa/swift-mode 4bdbc23 211/496: Normalize indentation for func


From: ELPA Syncer
Subject: [nongnu] elpa/swift-mode 4bdbc23 211/496: Normalize indentation for function declration with argument list on the
Date: Sun, 29 Aug 2021 11:33:37 -0400 (EDT)

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

    Normalize indentation for function declration with argument list on the
    second line
---
 swift-mode.el             |  4 ++++
 test/indentation-tests.el | 30 ++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/swift-mode.el b/swift-mode.el
index c8e2d42..6d6776c 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -361,6 +361,10 @@
              swift-indent-offset
            (smie-rule-parent))))
 
+    ;; Disable unnecessary default indentation for
+    ;; "func" and "class" keywords
+    (`(:after . ,(or `"func" `"class")) (smie-rule-parent 0))
+
     (`(:after . "(") (smie-rule-parent swift-indent-offset))
     (`(:before . "(")
      (cond
diff --git a/test/indentation-tests.el b/test/indentation-tests.el
index 0b881f9..56ffafd 100644
--- a/test/indentation-tests.el
+++ b/test/indentation-tests.el
@@ -1232,6 +1232,36 @@ aaaaaa.aaaaaaaaaaaaaaaaaaaaa(
 )
 ")
 
+(check-indentation indents-long-parameters/3
+                   "
+public func tableView(
+|tableView: UITableView,
+    commitEditingStyle editingStyle: UITableViewCellEditingStyle,
+    forRowAtIndexPath indexPath: NSIndexPath) {
+}
+" "
+public func tableView(
+    |tableView: UITableView,
+    commitEditingStyle editingStyle: UITableViewCellEditingStyle,
+    forRowAtIndexPath indexPath: NSIndexPath) {
+}
+")
+
+(check-indentation indents-long-parameters/4
+                   "
+func a(
+        |a: a,
+    a: a,
+    a: a) {
+}
+" "
+func a(
+    |a: a,
+    a: a,
+    a: a) {
+}
+")
+
 (check-indentation indents-multiline-expressions-to-user-defined-offset/1
                    "
 NSNotificationCenter.defaultCenter()



reply via email to

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