diff --git a/app/HieWrapper.hs b/app/HieWrapper.hs index 49d404817..37dba4ed1 100644 --- a/app/HieWrapper.hs +++ b/app/HieWrapper.hs @@ -54,9 +54,7 @@ main = do run :: GlobalOpts -> IO () run opts = do - let mLogFileName = case optLogFile opts of - Just f -> Just f - Nothing -> Nothing + let mLogFileName = optLogFile opts logLevel = if optDebugOn opts then L.DEBUG @@ -85,12 +83,11 @@ run opts = do let hieBin = "hie-" ++ ghcVersion - backupHieBin = "hie-" ++ reverse (tail $ dropWhile (/='.') $ reverse ghcVersion) + backupHieBin = "hie-" ++ init (dropWhileEnd (/='.') ghcVersion) + candidates' = [hieBin, backupHieBin, "hie"] + candidates = map (++ exeExtension) candidates' - logm $ "hie exe candidates :" ++ show (hieBin,backupHieBin) - - let candidates' = [hieBin, backupHieBin, "hie"] - candidates = map (++ exeExtension) candidates' + logm $ "hie exe candidates :" ++ show candidates mexes <- traverse findExecutable candidates @@ -98,7 +95,6 @@ run opts = do Nothing -> logm $ "cannot find any hie exe, looked for:" ++ intercalate ", " candidates Just e -> do logm $ "found hie exe at:" ++ e - -- putStrLn $ "found hie exe at:" ++ e args <- getArgs logm $ "args:" ++ show args logm "launching ....\n\n\n" diff --git a/app/MainHie.hs b/app/MainHie.hs index 57eea99d3..bdf900c9c 100644 --- a/app/MainHie.hs +++ b/app/MainHie.hs @@ -100,9 +100,7 @@ main = do run :: GlobalOpts -> IO () run opts = do - let mLogFileName = case optLogFile opts of - Just f -> Just f - Nothing -> Nothing + let mLogFileName = optLogFile opts logLevel = if optDebugOn opts then L.DEBUG diff --git a/docs/Hacking.md b/docs/Hacking.md index 76ae6d0cb..128fec386 100644 --- a/docs/Hacking.md +++ b/docs/Hacking.md @@ -17,6 +17,9 @@ To build and test with all of them, use make test ``` +Note that some tests require `liquid` binary to be present in your PATH. +To install it follow the instructions in [liquidhaskell](https://github.com/ucsd-progsys/liquidhaskell/blob/develop/INSTALL.md). + To see what version/compiler you are running ```bash @@ -130,7 +133,7 @@ the `plugins` table. ### Operation -When a request is recived from any of the frontends, this is routed to the +When a request is received from any of the frontends, this is routed to the central dispatcher via a `Chan`. Based on the specified plugin name and `IdeRequest` `ideCommand` value the appropriate `UiCommand` is identified and its `uiFunc` is called. @@ -144,5 +147,5 @@ type Dispatcher = forall m. (MonadIO m,GHC.GhcMonad m,HasIdeState m) => IdeReque This type is not the monad used in `HIE`, but does guarantee that it can access IO and the `HIE` state, which is currently only the table of plugins. -It also makes the `GhcMonad` available. In a fully general version this my not +It also makes the `GhcMonad` available. In a fully general version this may not be necessary. diff --git a/docs/Protocol.md b/docs/Protocol.md index 02e2b30c6..1d1d658ce 100644 --- a/docs/Protocol.md +++ b/docs/Protocol.md @@ -4,7 +4,7 @@ https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md -Advantages include widespread tooling and IDE support, and standarisation. +Advantages include widespread tooling and IDE support, and standardization. Implemented in [LspStdio.hs](../src/Haskell/Ide/Engine/Transport/LspStdio.hs) diff --git a/docs/hcar/2015.tex b/docs/hcar/2015.tex index 30ae03924..e4724031b 100644 --- a/docs/hcar/2015.tex +++ b/docs/hcar/2015.tex @@ -25,7 +25,7 @@ Idris community has done toward an interactive editing environment as well. This is a deliberately broad scope, the initial versions will be very limited at first. The sooner we can get started the sooner we will have something concrete -to criticise and improve. +to criticize and improve. Help is very much needed and wanted so if this is a problem that interests you, please pitch in! This is not a project just for a small inner circle. Anyone diff --git a/src/Haskell/Ide/Engine/Plugin/Base.hs b/src/Haskell/Ide/Engine/Plugin/Base.hs index 289eb6125..d2c2a85f0 100644 --- a/src/Haskell/Ide/Engine/Plugin/Base.hs +++ b/src/Haskell/Ide/Engine/Plugin/Base.hs @@ -111,21 +111,18 @@ getProjectGhcVersion = do if isStackProject && isStackInstalled then do L.infoM "hie" "Using stack GHC version" - catch (tryCommand "stack ghc -- --version") $ \e -> do + catch (tryCommand "stack ghc -- --numeric-version") $ \e -> do L.errorM "hie" $ show (e :: SomeException) L.infoM "hie" "Couldn't find stack version, falling back to plain GHC" - tryCommand "ghc --version" + tryCommand "ghc --numeric-version" else do L.infoM "hie" "Using plain GHC version" - tryCommand "ghc --version" + tryCommand "ghc --numeric-version" where tryCommand cmd = - crackGhcVersion <$> readCreateProcess (shell cmd) "" - -- "The Glorious Glasgow Haskell Compilation System, version 8.4.3\n" - -- "The Glorious Glasgow Haskell Compilation System, version 8.4.2\n" - crackGhcVersion :: String -> String - crackGhcVersion st = reverse $ takeWhile (/=' ') $ tail $ reverse st + -- Drop '\n' from the output like "7.10.3\n", "8.4.3\n" + init <$> readCreateProcess (shell cmd) "" hieGhcVersion :: String hieGhcVersion = VERSION_ghc diff --git a/src/Haskell/Ide/Engine/Transport/LspStdio.hs b/src/Haskell/Ide/Engine/Transport/LspStdio.hs index 276f1f475..ee88fff7b 100644 --- a/src/Haskell/Ide/Engine/Transport/LspStdio.hs +++ b/src/Haskell/Ide/Engine/Transport/LspStdio.hs @@ -810,9 +810,7 @@ requestDiagnostics DiagnosticsRequest{trigger, file, trackingNumber, documentVer forM_ dss $ \(pid,ds) -> do logm $ "requestDiagnostics: calling diagFunc for plugin:" ++ show pid let - enabled = case Map.lookup pid dpsEnabled of - Nothing -> True - Just flag -> flag + enabled = Map.findWithDefault True pid dpsEnabled publishDiagnosticsIO = Core.publishDiagnosticsFunc lf maxToSend = maybe 50 maxNumberOfProblems mc sendOne (fileUri,ds') = do