ghcid 0.6.6 → 0.6.7
raw patch · 10 files changed
+58/−27 lines, 10 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGES.txt +3/−0
- LICENSE +1/−1
- ghcid.cabal +17/−11
- src/Ghcid.hs +11/−5
- src/Language/Haskell/Ghcid.hs +1/−1
- src/Language/Haskell/Ghcid/Parser.hs +8/−2
- src/Language/Haskell/Ghcid/Util.hs +2/−5
- src/Session.hs +1/−1
- src/Test/Ghcid.hs +1/−1
- src/Test/Parser.hs +13/−0
CHANGES.txt view
@@ -1,5 +1,8 @@ Changelog for ghcid +0.6.7+ #104, add --ignore-loaded flag for use with -fobject-code+ #103, deal with new GHC error formatting 0.6.6 #89, exit sooner when the child process exits unexpectedly Add Eq instance for Ghci
LICENSE view
@@ -1,4 +1,4 @@-Copyright Neil Mitchell 2014-2016.+Copyright Neil Mitchell 2014-2017. All rights reserved. Redistribution and use in source and binary forms, with or without
ghcid.cabal view
@@ -1,19 +1,19 @@ cabal-version: >= 1.18 build-type: Simple name: ghcid-version: 0.6.6+version: 0.6.7 license: BSD3 license-file: LICENSE category: Development author: Neil Mitchell <ndmitchell@gmail.com>, jpmoresmau maintainer: Neil Mitchell <ndmitchell@gmail.com>-copyright: Neil Mitchell 2014-2016+copyright: Neil Mitchell 2014-2017 synopsis: GHCi based bare bones IDE description: Either \"GHCi as a daemon\" or \"GHC + a bit of an IDE\". A very simple Haskell development tool which shows you the errors in your project and updates them whenever you save. Run @ghcid --topmost --command=ghci@, where @--topmost@ makes the window on top of all others (Windows only) and @--command@ is the command to start GHCi on your project (defaults to @ghci@ if you have a @.ghci@ file, or else to @cabal repl@). homepage: https://github.com/ndmitchell/ghcid#readme bug-reports: https://github.com/ndmitchell/ghcid/issues-tested-with: GHC==8.0.1, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3+tested-with: GHC==8.2.1, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3 extra-doc-files: CHANGES.txt README.md@@ -32,8 +32,7 @@ directory, extra >= 1.2, process >= 1.1,- cmdargs >= 0.10,- terminal-size >= 0.3+ cmdargs >= 0.10 if os(windows) build-depends: Win32 else@@ -42,10 +41,9 @@ exposed-modules: Language.Haskell.Ghcid other-modules:- Paths_ghcid,- Language.Haskell.Ghcid.Types,- Language.Haskell.Ghcid.Parser,- Language.Haskell.Ghcid.Terminal,+ Paths_ghcid+ Language.Haskell.Ghcid.Types+ Language.Haskell.Ghcid.Parser Language.Haskell.Ghcid.Util executable ghcid@@ -103,7 +101,15 @@ else build-depends: unix other-modules:- Test.Parser+ Ghcid+ Language.Haskell.Ghcid+ Language.Haskell.Ghcid.Parser+ Language.Haskell.Ghcid.Terminal+ Language.Haskell.Ghcid.Types+ Language.Haskell.Ghcid.Util+ Session Test.API- Test.Util Test.Ghcid+ Test.Parser+ Test.Util+ Wait
src/Ghcid.hs view
@@ -46,6 +46,7 @@ ,restart :: [FilePath] ,directory :: FilePath ,outputfile :: [FilePath]+ ,ignoreLoaded :: Bool } deriving (Data,Typeable,Show) @@ -65,6 +66,7 @@ ,reload = [] &= typ "PATH" &= help "Reload when the given file or directory contents change (defaults to none)" ,directory = "." &= typDir &= name "C" &= help "Set the current directory" ,outputfile = [] &= typFile &= name "o" &= help "File to write the full output to"+ ,ignoreLoaded = False &= explicit &= name "ignore-loaded" &= help "Keep going if no files are loaded. Requires --reload to be set." } &= verbosity &= program "ghcid" &= summary ("Auto reloading GHCi daemon v" ++ showVersion version) @@ -115,7 +117,7 @@ "stack exec --test -- ghci" : opts in f flags $ "stack.yaml":cabal | ".ghci" `elem` files -> f ("ghci":opts) [".ghci"]- | cabal /= [] -> f (if arguments == [] then "cabal repl":map ("--ghc-options=" ++) opts else "cabal exec -- ghci":opts) cabal+ | cabal /= [] -> f (if null arguments then "cabal repl":map ("--ghc-options=" ++) opts else "cabal exec -- ghci":opts) cabal | otherwise -> f ("ghci":opts) [] where f c r = o{command = unwords $ c ++ map escape arguments, arguments = [], restart = restart ++ r}@@ -178,6 +180,10 @@ | m@Message{} <- maybe [] snd load] termOutput $ load ++ map (Plain,) msg ++ replicate (height - (length load + length msg)) (Plain,"") + when (ignoreLoaded && null reload) $ do+ putStrLn "--reload must be set when using --ignore-loaded"+ exitFailure+ restartTimes <- mapM getModTime restart curdir <- getCurrentDirectory @@ -208,8 +214,8 @@ outputFill (Just (loadedCount, messages)) ["Running test..." | isJust test] forM_ outputfile $ \file -> writeFile file $ unlines $ map snd $ prettyOutput loadedCount $ filter isMessage messages- when (null loaded) $ do- putStrLn $ "No files loaded, nothing to wait for. Fix the last error and restart."+ when (null loaded && not ignoreLoaded) $ do+ putStrLn "No files loaded, nothing to wait for. Fix the last error and restart." exitFailure whenJust test $ \t -> do whenLoud $ outStrLn $ "%TESTING: " ++ t@@ -228,12 +234,12 @@ if restartTimes == restartTimes2 then do nextWait <- waitFiles waiter fire nextWait =<< sessionReload session- else do+ else runGhcid session waiter termSize termOutput opts nextWait <- waitFiles waiter (messages, loaded) <- sessionStart session command- when (null loaded) $ do+ when (null loaded && not ignoreLoaded) $ do putStrLn $ "\nNo files loaded, GHCi is not working properly.\nCommand: " ++ command exitFailure fire nextWait (messages, loaded)
src/Language/Haskell/Ghcid.hs view
@@ -124,7 +124,7 @@ when (isNothing res) $ fail "Ghcid.exec, computation is already running, must be used single-threaded" - let ghciInterrupt = withLock isInterrupting $ do+ let ghciInterrupt = withLock isInterrupting $ whenM (fmap isNothing $ withLockTry isRunning $ return ()) $ do whenLoud $ outStrLn "%INTERRUPT" interruptProcessGroupOf ghciProcess
src/Language/Haskell/Ghcid/Parser.hs view
@@ -39,8 +39,8 @@ -- take position, including span if present , (pos,rest) <- span (\c -> c == ':' || c == '-' || isSpan c || isDigit c) rest -- separate line and column, ignoring span (we want the start point only)- , [p1,p2] <- map read $ wordsBy (\c -> c == ':' || isSpan c) $ takeWhile (\c->c /= '-') pos - , (msg,las) <- span (isPrefixOf " ") xs+ , [p1,p2] <- map read $ wordsBy (\c -> c == ':' || isSpan c) $ takeWhile (/= '-') pos+ , (msg,las) <- span isMessageBody xs , rest <- trimStart $ unwords $ rest : xs , sev <- if "warning:" `isPrefixOf` lower rest then Warning else Error = Message sev file (p1,p2) (x:msg) : f las@@ -57,6 +57,12 @@ f (_:xs) = f xs f [] = [] isSpan c = c== ',' || c == '(' || c == ')'++-- After the file location, message bodies are indented (perhaps prefixed by a line number)+isMessageBody :: String -> Bool+isMessageBody xs = isPrefixOf " " xs || case break (=='|') xs of+ (prefix, _:_) | all (\x -> isSpace x || isDigit x) prefix -> True+ _ -> False -- A filename, followed by a colon - be careful to handle Windows drive letters, see #61 breakFileColon :: String -> Maybe (FilePath, String)
src/Language/Haskell/Ghcid/Util.hs view
@@ -3,7 +3,7 @@ module Language.Haskell.Ghcid.Util( dropPrefixRepeatedly, chunksOfWord,- outWith, outStrLn, outStr,+ outWith, outStrLn, allGoodMessage, getModTime, getModTimeResolution ) where@@ -37,11 +37,8 @@ outWith :: IO a -> IO a outWith = withLock lock -outStr :: String -> IO ()-outStr = outWith . putStr- outStrLn :: String -> IO ()-outStrLn s = outStr $ s ++ "\n"+outStrLn = outWith . putStrLn -- | The message to show when no errors have been reported
src/Session.hs view
@@ -4,7 +4,7 @@ -- Not suitable for calling multithreaded. module Session( Session, withSession,- sessionStart, sessionRestart, sessionReload,+ sessionStart, sessionReload, sessionExecAsync, ) where
src/Test/Ghcid.hs view
@@ -40,7 +40,7 @@ copyDir :: FilePath -> IO a -> IO () copyDir dir act = do b <- doesDirectoryExist dir- if not b then putStrLn $ "Couldn't run test because test source is missing, " ++ dir else void $ do+ if not b then putStrLn $ "Couldn't run test because test source is missing, " ++ dir else void $ withTempDir $ \tdir -> do xs <- withCurrentDirectory dir $ listFilesRecursive "." forM_ xs $ \x -> do
src/Test/Parser.hs view
@@ -12,6 +12,7 @@ parserTests = testGroup "Parser tests" [testParseShowModules ,testParseLoad+ ,testParseLoadGhc82 ,testParseLoadSpans ] @@ -51,6 +52,18 @@ ,Message {loadSeverity = Warning, loadFile = "C:\\GHCi.hs", loadFilePos = (82,1), loadMessage = ["C:\\GHCi.hs:82:1: warning: Defined but not used: \8216foo\8217"]} ,Message {loadSeverity = Warning, loadFile = "src\\Haskell.hs", loadFilePos = (4,23), loadMessage = ["src\\Haskell.hs:4:23:"," Warning: {-# SOURCE #-} unnecessary in import of `Boot'"]} ,Message {loadSeverity = Error, loadFile = "src\\Boot.hs-boot", loadFilePos = (2,8), loadMessage = ["src\\Boot.hs-boot:2:8:"," File name does not match module name:"," Saw: `BootX'"," Expected: `Boot'"]}+ ]++testParseLoadGhc82 :: TestTree+testParseLoadGhc82 = testCase "GHC 8.2 Load Parsing" $ parseLoad+ ["[18 of 24] Compiling Physics ( Physics.hs, interpreted )"+ ,"Physics.hs:30:18: error: parse error on input ‘^*’"+ ," |"+ ,"30 | dx = ' ^* delta"+ ," | ^^"+ ] @?=+ [Loading "Physics" "Physics.hs"+ ,Message {loadSeverity = Error, loadFile = "Physics.hs", loadFilePos = (30,18), loadMessage = ["Physics.hs:30:18: error: parse error on input ‘^*’" ," |" ,"30 | dx = ' ^* delta" ," | ^^"]} ] -- | Test when error messages include spans (-ferror-spans)