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

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

[nongnu] elpa/swift-mode ebc60c8 197/496: Make closure block in function


From: ELPA Syncer
Subject: [nongnu] elpa/swift-mode ebc60c8 197/496: Make closure block in function argument close at the offset 0
Date: Sun, 29 Aug 2021 11:33:35 -0400 (EDT)

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

    Make closure block in function argument close at the offset 0
---
 swift-mode.el             |  2 ++
 test/indentation-tests.el | 24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/swift-mode.el b/swift-mode.el
index 8238521..c2f2150 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -356,6 +356,8 @@
       ((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 e3f91e7..1a9af87 100644
--- a/test/indentation-tests.el
+++ b/test/indentation-tests.el
@@ -1325,6 +1325,30 @@ if a {
 }
 ")
 
+(check-indentation anonymous-function-as-a-argument/1
+                   "
+UIView.animateWithDuration(1.0,
+                           animations: {
+|})
+" "
+UIView.animateWithDuration(1.0,
+                           animations: {
+|})
+")
+
+(check-indentation anonymous-function-as-a-argument/2
+                   "
+UIView.animateWithDuration(
+    1.0,
+    animations: {
+|})
+" "
+UIView.animateWithDuration(
+    1.0,
+    animations: {
+|})
+")
+
 (provide 'indentation-tests)
 
 ;;; indentation-tests.el ends here



reply via email to

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