[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swift-mode 2d0194e 184/496: Correct several indentation ca
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swift-mode 2d0194e 184/496: Correct several indentation cases for class defitinion |
Date: |
Sun, 29 Aug 2021 11:33:32 -0400 (EDT) |
branch: elpa/swift-mode
commit 2d0194e8065548e03a753d0268dcd025388c7b51
Author: ap4y <lod@pisem.net>
Commit: ap4y <lod@pisem.net>
Correct several indentation cases for class defitinion
---
swift-mode.el | 6 ++-
test/indentation-tests.el | 117 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 121 insertions(+), 2 deletions(-)
diff --git a/swift-mode.el b/swift-mode.el
index c61ca5c..8eecbc2 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -289,7 +289,9 @@
;; Static indentation relatively to =
((smie-rule-parent-p "=") 2)
;; Rule for the case statement.
- ((smie-rule-parent-p "case") swift-indent-offset)))
+ ((smie-rule-parent-p "case") swift-indent-offset)
+ ;; Rule for the class definition.
+ ((smie-rule-parent-p "class") (smie-rule-parent swift-indent-offset))))
(`(:after . "{")
(if (smie-rule-parent-p "switch")
@@ -317,7 +319,7 @@
;; definitions with swift-indent-offset
(`(:before . ",")
(if (smie-rule-parent-p "class")
- swift-indent-offset))
+ (smie-rule-parent swift-indent-offset)))
(`(:before . "if")
(if (smie-rule-prev-p "else")
diff --git a/test/indentation-tests.el b/test/indentation-tests.el
index 837108f..4a2ebc1 100644
--- a/test/indentation-tests.el
+++ b/test/indentation-tests.el
@@ -639,6 +639,66 @@ class Foo: Foo, Bar,
}
")
+(check-indentation indents-class-declaration/6
+ "
+class Foo:
+|Foo, Bar, Baz {
+}
+" "
+class Foo:
+ |Foo, Bar, Baz {
+}
+")
+
+(check-indentation indents-class-declaration/7
+ "
+class Foo: Bar<A, B,
+|C>
+" "
+class Foo: Bar<A, B,
+ |C>
+")
+
+(check-indentation indents-class-declaration/8
+ "
+class Foo: Bar<A, B,
+|[C]>
+" "
+class Foo: Bar<A, B,
+ |[C]>
+")
+
+(check-indentation indents-class-declaration/9
+ "
+class Foo<A: B<C>>:
+ |Bar
+" "
+class Foo<A: B<C>>:
+ |Bar
+")
+
+(check-indentation indents-public-class-declaration/1
+ "
+public class Foo: Foo, Bar,
+|Baz {
+}
+" "
+public class Foo: Foo, Bar,
+ |Baz {
+}
+")
+
+(check-indentation indents-public-class-declaration/2
+ "
+public class Foo {
+ |foo
+}
+" "
+public class Foo {
+ |foo
+}
+")
+
(check-indentation indents-func-declaration/1
"
func Foo(a: String) {
@@ -1037,6 +1097,63 @@ func foo() {
}
")
+(check-indentation block-inside-parenthesis/3
+ "
+\({
+|a
+})
+" "
+\({
+ |a
+})
+")
+
+(check-indentation indent-long-if-else-if/1
+ "
+if a {
+ a
+} else if a {
+ a
+} else if a {
+ |a
+} else {
+ a
+}
+" "
+if a {
+ a
+} else if a {
+ a
+} else if a {
+ |a
+} else {
+ a
+}
+")
+
+(check-indentation indent-long-if-else-if/2
+ "
+if a {
+ a
+} else if a {
+ a
+} else if a {
+ a
+|} else {
+ a
+}
+" "
+if a {
+ a
+} else if a {
+ a
+} else if a {
+ a
+|} else {
+ a
+}
+")
+
(provide 'indentation-tests)
;;; indentation-tests.el ends here
- [nongnu] elpa/swift-mode 37fb4d0 119/496: Release 0.2.0, (continued)
- [nongnu] elpa/swift-mode 37fb4d0 119/496: Release 0.2.0, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode ca6437a 116/496: Merge pull request #29 from ap4y/master, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 79622d7 123/496: Merge pull request #32 from ap4y/fix_nested_multi_line_comments, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 7826550 124/496: Fix code alignment, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode dd8f793 133/496: Make multi-line dot statement offset customisable value, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 2d478bf 140/496: Merge pull request #46 from ap4y/multiline_op_statemenets, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode e09694f 158/496: Release 0.3.0, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 9b6f599 146/496: Apply swift-indent-offset to multi-line class definitions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 4286ff9 148/496: Merge pull request #52 from ap4y/fix_47, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 0f57a7d 179/496: Add lexer rule for ":" token., ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 2d0194e 184/496: Correct several indentation cases for class defitinion,
ELPA Syncer <=
- [nongnu] elpa/swift-mode f8190d6 186/496: Extract function into separate grammar and add return typo to the, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode fb2f48e 187/496: Add rule for assignment expression, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 01bcc35 192/496: Improve grammar for functions and contraint protocols grammar to, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode c09229a 198/496: Use semantic hanging-p function instead of custom regex when checking, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 462ea17e 221/496: Improve closures grammar and add several related indentation rules, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode f42752b 223/496: Respect comments when calculating position of the implicit semicolon, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode b4b56f6 246/496: Merge pull request #99 from uk-ar/fix-indents-around-comma, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode d047843 258/496: Fix token for :, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode ba39552 261/496: Fix test failure on travis, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 1f39b11 288/496: Fix indent for ternary operator, ELPA Syncer, 2021/08/29