Open ghost opened 8 years ago
Actually, something changed in the meantime. The command is called "build" again but I need some safeguard against output
being an empty string (because json-read-from-string
signals an error in that case).
(require 'json)
(flycheck-define-checker crystal-build
"A Crystal syntax checker using crystal build"
:command ("crystal"
"build"
"--no-codegen"
"--no-color"
"--format" "json"
source-inplace)
:error-parser
(lambda (output checker buffer)
(mapcar (lambda (err)
(flycheck-error-new :buffer buffer
:checker checker
:filename (cdr-safe (assoc 'file err))
:line (cdr-safe (assoc 'line err))
:column (cdr-safe (assoc 'column err))
:level 'error
:message (cdr-safe (assoc 'message err))))
(append nil (and output
(not (zerop (length output)))
(json-read-from-string output)))))
:modes crystal-mode
)
With the new crystal the arguments passed should be probably be
compile --no-color --no-codegen
instead ofcompile build --no-build --no-color
However, probably one should use the json output together with
json.el
or so to get accurate error informationActually, as a quick hack the following might work