branch: elpa/swift-mode commit e7330885d05b3095fdb429d9846cbbbdb873b96e Merge: ae32a8b cd0aa34 Author: Chris Barrett <chris.d.barr...@me.com> Commit: Chris Barrett <chris.d.barr...@me.com>
Merge pull request #20 from ap4y/flycheck_plugin Add flycheck support --- swift-mode.el | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/swift-mode.el b/swift-mode.el index 84faaff..a226a9b 100644 --- a/swift-mode.el +++ b/swift-mode.el @@ -293,6 +293,29 @@ Returns the column number as an integer." (list "Variables" (swift-mode--mk-regex-for-def "var") 1)) "Value for `imenu-generic-expression' in swift-mode.") +;;; Flycheck + +(eval-after-load 'flycheck + '(progn + (flycheck-def-option-var flycheck-swift-sdk-path nil swift + "A path to the targeted SDK" + :type '(repeat (directory :tag "iOS/MacOS SDK directory")) + :safe #'flycheck-string-list-p) + + (flycheck-define-checker swift + "Flycheck plugin for for Apple's Swift programming language." + :command ("swift" + (option-list "-sdk" flycheck-swift-sdk-path) + "-parse" source) + :error-patterns + ((error line-start (file-name) ":" line ":" column ": " + "error: " (message) line-end) + (warning line-start (file-name) ":" line ":" column ": " + "warning: " (message) line-end)) + :modes swift-mode) + + (add-to-list 'flycheck-checkers 'swift))) + ;;; Mode definition ;; HACK: This syntax table is lifted directly from `rust-mode'. There may be