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

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

[nongnu] elpa/swift-mode 5e3ab8c 139/496: Apply swift-indent-multiline-s


From: ELPA Syncer
Subject: [nongnu] elpa/swift-mode 5e3ab8c 139/496: Apply swift-indent-multiline-statement-offset to the multi-line
Date: Sun, 29 Aug 2021 11:33:23 -0400 (EDT)

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

    Apply swift-indent-multiline-statement-offset to the multi-line
    statements with hanging operator
---
 swift-mode.el             |  6 ++++++
 test/indentation-tests.el | 10 ++++++++++
 2 files changed, 16 insertions(+)

diff --git a/swift-mode.el b/swift-mode.el
index 4561d38..f16fbe9 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -280,6 +280,12 @@
              (looking-back "[ \t\n]" 1 t))
          (smie-rule-parent swift-indent-multiline-statement-offset)))
 
+    ;; Apply swift-indent-multiline-statement-offset if
+    ;; operator is the last symbol on the line
+    (`(:before . "OP")
+     (if (looking-at ".[\n]")
+         (smie-rule-parent swift-indent-multiline-statement-offset)))
+
     (`(:before . "if")
      (if (smie-rule-prev-p "else")
          (if (smie-rule-parent-p "{")
diff --git a/test/indentation-tests.el b/test/indentation-tests.el
index fd3d30c..f958732 100644
--- a/test/indentation-tests.el
+++ b/test/indentation-tests.el
@@ -850,6 +850,16 @@ let json_ary = NSJSONSerialization
 "
 ((swift-indent-multiline-statement-offset 4)))
 
+(check-indentation indents-multiline-expressions-to-user-defined-offset/4
+                   "
+let options = NSRegularExpressionOptions.CaseInsensitive &
+|NSRegularExpressionOptions.DotMatchesLineSeparators
+" "
+let options = NSRegularExpressionOptions.CaseInsensitive &
+                |NSRegularExpressionOptions.DotMatchesLineSeparators
+"
+((swift-indent-multiline-statement-offset 4)))
+
 (check-indentation indents-type-annotations/1
                    "
 typealias Foo = Bar<Foo.Baz, Foo>



reply via email to

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