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

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

[nongnu] elpa/swift-mode 5a858c7 218/496: Improve indentation of the arr


From: ELPA Syncer
Subject: [nongnu] elpa/swift-mode 5a858c7 218/496: Improve indentation of the array and dictionary expressions
Date: Sun, 29 Aug 2021 11:33:39 -0400 (EDT)

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

    Improve indentation of the array and dictionary expressions
---
 swift-mode.el             |  1 +
 test/indentation-tests.el | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/swift-mode.el b/swift-mode.el
index 2c7178d..aa665ec 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -377,6 +377,7 @@
      (cond
       ((smie-rule-prev-p "->") swift-indent-offset)
       ((smie-rule-parent-p "[") (smie-rule-parent swift-indent-offset))
+      ((smie-rule-parent-p "{") nil)
       (t (smie-rule-parent))))
     (`(:after . "->") (smie-rule-parent swift-indent-offset))
     ))
diff --git a/test/indentation-tests.el b/test/indentation-tests.el
index 0aea214..d522756 100644
--- a/test/indentation-tests.el
+++ b/test/indentation-tests.el
@@ -1058,6 +1058,38 @@ let foo = [
 ]
 ")
 
+(check-indentation indents-expressions/1
+                   "
+class Foo {
+    func a() {
+    |[a]
+    }
+}
+" "
+class Foo {
+    func a() {
+        |[a]
+    }
+}
+")
+
+(check-indentation indents-expressions/2
+                   "
+class Foo {
+    func a() {
+        a
+    |[a]
+    }
+}
+" "
+class Foo {
+    func a() {
+        a
+        |[a]
+    }
+}
+")
+
 (check-indentation indents-multiline-expressions/1
 "
 Foo.bar([foo: bar,



reply via email to

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