implement includes options for check
This commit is contained in:
parent
b09a8fb2ee
commit
b6d99e279c
2
Check.hs
2
Check.hs
@ -31,7 +31,7 @@ check opt fileName = withGHC $ do
|
||||
clearWarnings
|
||||
readRef ref
|
||||
where
|
||||
options = ["-Wall","-fno-warn-unused-do-bind"]
|
||||
options = ["-Wall","-fno-warn-unused-do-bind"] ++ map ((++) "-i") (checkIncludes opt)
|
||||
handleParseError ref e = do
|
||||
liftIO . writeIORef ref $ errBagToStrList . srcErrorMessages $ e
|
||||
return Succeeded
|
||||
|
@ -26,7 +26,7 @@ usage = "ghc-mod version 0.6.0\n"
|
||||
++ "\t ghc-mod list [-l]\n"
|
||||
++ "\t ghc-mod lang [-l]\n"
|
||||
++ "\t ghc-mod browse [-l] [-o] <module> [<module> ...]\n"
|
||||
++ "\t ghc-mod check <HaskellFile>\n"
|
||||
++ "\t ghc-mod check [-i inc] <HaskellFile>\n"
|
||||
++ "\t ghc-mod type <HaskellFile> <module> <expression>\n"
|
||||
++ "\t ghc-mod info <HaskellFile> <module> <expression>\n"
|
||||
++ "\t ghc-mod lint [-h opt] <HaskellFile>\n"
|
||||
@ -39,6 +39,7 @@ defaultOptions :: Options
|
||||
defaultOptions = Options {
|
||||
convert = toPlain
|
||||
, hlintOpts = []
|
||||
, checkIncludes = []
|
||||
, operators = False
|
||||
, packageConfs = []
|
||||
, useUserPackageConf = True
|
||||
@ -60,6 +61,9 @@ argspec = [ Option "l" ["tolisp"]
|
||||
, Option "" ["no-user-package-conf"]
|
||||
(NoArg (\opts -> opts{ useUserPackageConf = False }))
|
||||
"do not read the user package database"
|
||||
, Option "i" ["include"]
|
||||
(ReqArg (\i opts -> opts{ checkIncludes = i : (checkIncludes opts)}) "include")
|
||||
"directory to include in search for modules"
|
||||
]
|
||||
|
||||
parseArgs :: [OptDescr (Options -> Options)] -> [String] -> (Options, [String])
|
||||
|
1
Types.hs
1
Types.hs
@ -11,6 +11,7 @@ import GHC.Paths (libdir)
|
||||
data Options = Options {
|
||||
convert :: [String] -> String
|
||||
, hlintOpts :: [String]
|
||||
, checkIncludes :: [String]
|
||||
, operators :: Bool
|
||||
, packageConfs :: [FilePath]
|
||||
, useUserPackageConf :: Bool
|
||||
|
@ -16,6 +16,15 @@
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defcustom ghc-flymake-check-includes nil
|
||||
"list of directories to include when checking file"
|
||||
:type '(repeat string)
|
||||
:risky nil
|
||||
:require 'ghc-flymake
|
||||
:group 'ghc-flymake)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defconst ghc-error-buffer-name "*GHC Errors*")
|
||||
|
||||
(defconst ghc-flymake-allowed-file-name-masks
|
||||
@ -44,8 +53,11 @@
|
||||
(if ghc-flymake-command
|
||||
(let ((hopts (ghc-mapconcat (lambda (x) (list "-h" x)) opts)))
|
||||
`(,@hopts "lint" ,file))
|
||||
(list "check" file)))
|
||||
|
||||
(if (null ghc-flymake-check-includes)
|
||||
(list "check" file)
|
||||
(let ((includes (ghc-mapconcat (lambda (x) (list "-i" x)) ghc-flymake-check-includes)))
|
||||
`("check" ,@includes ,file)))))
|
||||
|
||||
(defun ghc-flymake-toggle-command ()
|
||||
(interactive)
|
||||
(setq ghc-flymake-command (not ghc-flymake-command))
|
||||
|
Loading…
Reference in New Issue
Block a user