branch: elpa/swift-mode
commit 848d0886438c9868896c8991d40418166fddef10
Author: taku0 <[email protected]>
Commit: taku0 <[email protected]>
Fix indentation after attributes with arguments
---
swift-mode-lexer.el | 13 ++++++++++++-
test/swift-files/declarations.swift | 11 ++++++++++-
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/swift-mode-lexer.el b/swift-mode-lexer.el
index 64d91c4..6469890 100644
--- a/swift-mode-lexer.el
+++ b/swift-mode-lexer.el
@@ -283,7 +283,18 @@
t)
;; Supress implicit semicolon after attributes.
- ((string-prefix-p "@" (swift-mode:token:text previous-token)) nil)
+ ((string-prefix-p "@" (swift-mode:token:text previous-token))
+ nil)
+
+ ;; Supress implicit semicolon after attributes with arguments.
+ ((and
+ (eq (swift-mode:token:type previous-token) '\))
+ (save-excursion
+ (backward-list)
+ (string-prefix-p
+ "@"
+ (swift-mode:token:text (swift-mode:backward-token-simple)))))
+ nil)
;; Inserts implicit semicolon before keywords that behave like method
;; names.
diff --git a/test/swift-files/declarations.swift
b/test/swift-files/declarations.swift
index 3f9549b..3a353de 100644
--- a/test/swift-files/declarations.swift
+++ b/test/swift-files/declarations.swift
@@ -29,7 +29,7 @@ class Foo {
=
xx
- @ABC
+ @ABC(aaa)
final
unowned(safe)
fileprivate
@@ -234,6 +234,15 @@ func
foo()
}
+func
+ foo()
+ ->
+ @A(aaa)
+ B {
+ foo()
+ foo()
+}
+
// Enumeration declarations
fileprivate