[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swift-mode 95ff004 479/496: Fix indentation of closures in
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swift-mode 95ff004 479/496: Fix indentation of closures inside condition-list |
Date: |
Sun, 29 Aug 2021 11:34:32 -0400 (EDT) |
branch: elpa/swift-mode
commit 95ff0041370660e839ed06aa92330694d8590d62
Author: taku0 <mxxouy6x3m_github@tatapa.org>
Commit: taku0 <mxxouy6x3m_github@tatapa.org>
Fix indentation of closures inside condition-list
Example:
```swift
if
foo(
a: {
}
)
{
}
if
a == [
b {
}
]
{
}
```
---
swift-mode-indent.el | 2 +-
test/swift-files/indent/statements.swift | 122 +++++++++++++++++++++++++++++++
2 files changed, 123 insertions(+), 1 deletion(-)
diff --git a/swift-mode-indent.el b/swift-mode-indent.el
index a5ae4a2..ea898c0 100644
--- a/swift-mode-indent.el
+++ b/swift-mode-indent.el
@@ -921,7 +921,7 @@ This function is also used for close-curly-brace."
(save-excursion
(goto-char (swift-mode:token:end
(swift-mode:backward-sexps-until
- swift-mode:statement-parent-tokens)))
+ (append swift-mode:statement-parent-tokens '(\( \[)))))
(setq next-token (swift-mode:forward-token-or-list))
(while (<= (point) pos)
(cond
diff --git a/test/swift-files/indent/statements.swift
b/test/swift-files/indent/statements.swift
index 87bdf65..a58cec8 100644
--- a/test/swift-files/indent/statements.swift
+++ b/test/swift-files/indent/statements.swift
@@ -304,6 +304,24 @@ for
}
+for
+ x in foo(
+ a: {
+ b()
+ }
+ )
+{
+}
+
+for
+ x in [
+ a {
+ b()
+ }
+ ]
+{
+}
+
// While statements
while foo
@@ -394,6 +412,30 @@ while let
foo()
}
+
+while
+ let foo = bar(
+ a: {
+ b()
+ }
+ )
+{
+}
+
+while
+ foo(
+ a: {
+ b()
+ }
+ ),
+ a == [
+ b {
+ c()
+ }
+ ]
+{
+}
+
// Repeat-while statements
repeat {
@@ -428,6 +470,20 @@ repeat {
.bar()
.baz()
+repeat {
+} while foo(
+ a: {
+ b()
+ }
+ )
+
+repeat {
+} while a == [
+ b {
+ c()
+ }
+ ]
+
// If statement
if x
@@ -514,6 +570,33 @@ if foo.bar +++ {
foo()
}
+if
+ foo(
+ a: {
+ b()
+ }
+ ),
+ a == [
+ b {
+ c()
+ }
+ ]
+{
+}
+
+if
+ let foo = bar(
+ a: {
+ b()
+ }
+ ),
+ let foo = bar(
+ a: {
+ b()
+ }
+ )
+{
+}
// Guard statement
@@ -598,6 +681,29 @@ guard
foo()
}
+guard
+ let foo = bar(
+ a: {
+ b()
+ }
+ )
+else {
+}
+
+guard
+ foo(
+ a: {
+ b()
+ }
+ ),
+ a == [
+ b {
+ c()
+ }
+ ]
+else {
+}
+
// Switch statement
switch foo
@@ -939,7 +1045,23 @@ switch foo {
// swift-mode:test:eval (setq-local swift-mode:switch-case-offset 0)
+switch
+ foo(
+ a: {
+ b()
+ }
+ )
+{
+}
+switch
+ [
+ a {
+ b()
+ }
+ ]
+{
+}
// Labeled statements
- [nongnu] elpa/swift-mode 286b46e 459/496: Highlight #filePath, (continued)
- [nongnu] elpa/swift-mode 286b46e 459/496: Highlight #filePath, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode fa22f12 461/496: Add tests for multiple trailing closures, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 2ab9ea1 458/496: Bump version to 8.0.2, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode a067fe7 454/496: Add travis emacs version 26.2 and 26.3, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 29759f5 456/496: Fix indentation of generic-parameter-clause, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 5eb806b 470/496: Fix GitHub Action, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 9757df9 475/496: Improve regular expression to avoid false positives, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 5074a02 480/496: Fix font-lock of successive identifiers, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 2293e78 481/496: Fix indentation of throws without result type, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 19c956c 482/496: Fix GitHub Action, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 95ff004 479/496: Fix indentation of closures inside condition-list,
ELPA Syncer <=
- [nongnu] elpa/swift-mode db3603a 489/496: Highlight async/await, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 4a5f577 488/496: Tweak comments and style, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 86043c2 093/496: Define electric-indent characters, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode b298842 094/496: Merge pull request #26 from ap4y/electric_indent, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 027522d 090/496: Merge pull request #23 from ap4y/flycheck_improvements, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 20e4ecf 099/496: Merge pull request #27 from ap4y/highlight_declaration_with_destructuring, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 53f9042 100/496: Rename swift-mode--font-lock-defaults to swift-font-lock-keywords and, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 72eb603 105/496: Use semver friendly version number, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 021f0ab 104/496: Remove flycheck code from .dir-locals.el as not everyone has flycheck installed, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 0c734dd 112/496: Indent multiline hash and array syntax same way as Xcode does, ELPA Syncer, 2021/08/29