emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/swift-mode fc64626 156/496: Merge pull request #56 from ap


From: ELPA Syncer
Subject: [nongnu] elpa/swift-mode fc64626 156/496: Merge pull request #56 from ap4y/fix_flycheck_issues
Date: Sun, 29 Aug 2021 11:33:27 -0400 (EDT)

branch: elpa/swift-mode
commit fc646261630aa23f2e81933fd7cb638771623b0a
Merge: 1753f23 9c716c1
Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
Commit: Bozhidar Batsov <bozhidar.batsov@gmail.com>

    Merge pull request #56 from ap4y/fix_flycheck_issues
    
    Fix flycheck issues
---
 README.md     |  8 +++++++-
 swift-mode.el | 28 ++++++++++++++--------------
 2 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/README.md b/README.md
index d96c4fc..edec659 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Major-mode for Apple's [Swift programming language][swift]. 
Provides:
 - syntax highlighting
 - indentation
 - code navigation with [imenu][]
-- automatic syntax checking with [flycheck][]
+- automatic syntax checking with [flycheck][] (disabled by default)
 
 This is currently at an early stage of development and there's plenty of work 
to
 do. Check the issue tracker.
@@ -62,6 +62,12 @@ If you'd like to get on-the-fly syntax checking you should 
install
 M-x package-install flycheck
 ```
 
+And enable `flycheck` checker for `swift`:
+
+```
+(add-to-list 'flycheck-checkers 'swift)
+```
+
 ### Manual
 
 You will need `make` and [Cask][] to build the project.
diff --git a/swift-mode.el b/swift-mode.el
index 452ca75..e16cf43 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -480,8 +480,9 @@
   '(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)
+       :type '(choice (const :tag "Don't link against sdk" nil)
+                      (string :tag "Targeted SDK path"))
+       :safe #'stringp)
 
      (flycheck-def-option-var flycheck-swift-linked-sources nil swift
        "Source files path to link against. Can be glob, i.e. *.swift"
@@ -493,30 +494,29 @@
        "Flycheck plugin for for Apple's Swift programming language."
        :command ("swift"
                  "-frontend" "-parse"
-                 (option-list "-sdk" flycheck-swift-sdk-path)
+                 (option "-sdk" flycheck-swift-sdk-path)
                  ;; Swift compiler will complain about redeclaration
                  ;; if we will include original file along with
                  ;; temporary source file created by flycheck.
                  ;; We also don't want a hidden emacs interlock files.
                  (eval
                   (let (source file)
-                    (setq source (flycheck-substitute-argument 'source 'swift))
-                    (setq file (file-name-nondirectory source))
-                    (remove-if-not
-                     #'(lambda (path)
-                         (and
-                          (eq (string-match ".#" path) nil)
-                          (eq (string-match file path) nil)))
-                     (file-expand-wildcards flycheck-swift-linked-sources))))
+                    (when flycheck-swift-linked-sources
+                      (setq source (car (flycheck-substitute-argument 'source 
'swift)))
+                      (setq file (file-name-nondirectory source))
+                      (cl-remove-if-not
+                       #'(lambda (path)
+                           (and
+                            (eq (string-match ".#" path) nil)
+                            (eq (string-match file path) nil)))
+                       (file-expand-wildcards 
flycheck-swift-linked-sources)))))
                  "-primary-file" 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)))
+       :modes swift-mode)))
 
 ;;; REPL
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]