Skip to content

Commit 4f5eca5

Browse files
Add flycheck verify function
Refs #165.
1 parent 5fa66d4 commit 4f5eca5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

flycheck-fsharp.el

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@
3737
(defun flycheck-fsharp--can-make-request-p ()
3838
(fsharp-ac-can-make-request t))
3939

40+
(defun flycheck-verify-fsautocomlete (_checker)
41+
"Verify the F# syntax checker."
42+
(let* ((host (fsharp-ac--hostname (buffer-file-name)))
43+
(process (fsharp-ac-completion-process host))
44+
(status (when process (process-status process)))
45+
(command (when process (combine-and-quote-strings (process-command process)))))
46+
(list
47+
(flycheck-verification-result-new
48+
:label "FSharp.AutoComplete process"
49+
:message (cond
50+
((eq status 'run) command)
51+
(status (format "Invalid process status: %s (%s)" command status))
52+
("not running"))
53+
:face (if (eq status 'run) 'success '(bold error))))))
54+
4055
(defun flycheck-fsharp-fsautocomplete-lint-start (checker callback)
4156
"Start a F# syntax check with CHECKER.
4257
CALLBACK is the status callback passed by Flycheck."
@@ -52,6 +67,7 @@ CALLBACK is the status callback passed by Flycheck."
5267
See URL `https://github.com/fsharp/FsAutoComplete'."
5368
:start #'flycheck-fsharp-fsautocomplete-lint-start
5469
:predicate #'flycheck-fsharp--can-make-request-p
70+
:verify #'flycheck-verify-fsautocomlete
5571
:modes '(fsharp-mode))
5672

5773
(defvar flycheck-fsharp--error-callback-info nil)
@@ -68,6 +84,7 @@ See URL `https://github.com/fsharp/FsAutoComplete'."
6884
:start #'flycheck-fsharp-fsautocomplete-start
6985
:modes '(fsharp-mode)
7086
:predicate #'flycheck-fsharp--can-make-request-p
87+
:verify #'flycheck-verify-fsautocomlete
7188
:next-checkers '((info . fsharp-fsautocomplete-lint)))
7289

7390
(defun flycheck-fsharp-handle-lint (data)

0 commit comments

Comments
 (0)