[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swift-mode a6267eb 189/496: Improve indentation for the fu
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swift-mode a6267eb 189/496: Improve indentation for the function definitions |
Date: |
Sun, 29 Aug 2021 11:33:33 -0400 (EDT) |
branch: elpa/swift-mode
commit a6267ebec3cdb516cb5bb2ae8ca08984beca050e
Author: ap4y <lod@pisem.net>
Commit: ap4y <lod@pisem.net>
Improve indentation for the function definitions
---
swift-mode.el | 5 ++++-
test/indentation-tests.el | 39 ++++++++++++++++++++++++++++++++++++++-
2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/swift-mode.el b/swift-mode.el
index 193e9be..3f638b1 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -336,7 +336,10 @@
(`(:before . "(")
(if (smie-rule-next-p "[") (smie-rule-parent)))
- (`(:before . "[") (smie-rule-parent))
+ (`(:before . "[")
+ (if (smie-rule-prev-p "->") swift-indent-offset
+ (smie-rule-parent)))
+ (`(:after . "->") swift-indent-offset)
))
;;; Font lock
diff --git a/test/indentation-tests.el b/test/indentation-tests.el
index 4a2ebc1..c0b5d61 100644
--- a/test/indentation-tests.el
+++ b/test/indentation-tests.el
@@ -747,7 +747,7 @@ class Foo {
}
")
-(check-indentation indents-func-declaration/2
+(check-indentation indents-func-declaration/5
"
class func Foo() {
|foo
@@ -758,6 +758,43 @@ class func Foo() {
}
")
+(check-indentation indents-func-declaration/6
+ "
+func Foo(aaaaaaaaa:
+ |AAAAAAAAA) {
+}
+" "
+func Foo(aaaaaaaaa:
+ |AAAAAAAAA) {
+}
+")
+
+(check-indentation indents-func-declaration/7
+ "
+func foo() ->
+|Foo
+" "
+func foo() ->
+ |Foo
+")
+
+(check-indentation indents-func-declaration/8
+ "
+func foo() ->
+|(A, B) {}
+" "
+func foo() ->
+ |(A, B) {}
+")
+
+(check-indentation indents-func-declaration/9
+ "
+func foo() ->
+|[A] {}
+" "
+func foo() ->
+ |[A] {}
+")
(check-indentation indents-declaration/1
"
var foo = bar + baz
- [nongnu] elpa/swift-mode 4059bc1 135/496: Add dot(.) to the allowed symbols inside string interpolation, (continued)
- [nongnu] elpa/swift-mode 4059bc1 135/496: Add dot(.) to the allowed symbols inside string interpolation, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 88a83ad 145/496: Apply DECSPEC token class only for functions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode fc009b5 069/496: Add font locking for indentation tests, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode ae32a8b 071/496: Add basic imenu support, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode d02e2dc 024/496: Update contributors, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode fc64626 156/496: Merge pull request #56 from ap4y/fix_flycheck_issues, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 9cf667c 159/496: Start work on 0.4, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode cba4538 161/496: Merge pull request #61 from ckruse/fix_55, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 5611c0f 164/496: Updated syntax: a lot of attributes moved to keywords, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 250e8e4 172/496: Merge pull request #67 from jmibanez/fix-flycheck-and-byte-compilation-bug, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode a6267eb 189/496: Improve indentation for the function definitions,
ELPA Syncer <=
- [nongnu] elpa/swift-mode 782378c 214/496: Correct regex in lexer for the "default" keyword, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode c38b721 216/496: Support default values for arguments in function declaration, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 2cb54c9 222/496: Make grammar for if statement a bit more precise, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode b6bad10 225/496: Set minimum required version to 24.4, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 4a27477 230/496: Merge pull request #89 from uk-ar/fix-indent-in-trailing-closure, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 4289bd7 235/496: Fix implicit semicolon rule, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode a29398b 239/496: Fix half-open range operator, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 7f25806 241/496: Add as! operator, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 86339ed 247/496: Fix curly bracket's syntax table to enable electric-pair, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 37cab39 263/496: Improve indentation for switch and class statements, ELPA Syncer, 2021/08/29