Skip to content

Commit beaf915

Browse files
committed
Use latest mpickering hls, with hover tweaks added
1 parent 54cd823 commit beaf915

9 files changed

+47
-52
lines changed

cabal.project

+1-6
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ source-repository-package
77
location: https://github.com/DanielG/cabal-helper.git
88
tag: 5b85a4b9e1c6463c94ffa595893ad02c9a3d2ec3
99

10-
source-repository-package
11-
type: git
12-
location: https://github.com/mpickering/hie-bios.git
13-
tag: 501cc337691cc9da45ff12db46d8b3af9a2a0eda
14-
1510
source-repository-package
1611
type: git
1712
location: https://github.com/wz1000/shake
@@ -27,4 +22,4 @@ package ghcide
2722

2823
write-ghc-environment-files: never
2924

30-
index-state: 2020-05-05T17:33:00Z
25+
index-state: 2020-05-09T16:01:39Z

exe/Main.hs

+26-21
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ import DynFlags (gopt_set, gopt_unset,
5454
updOptLevel)
5555
import DynFlags (PackageFlag(..), PackageArg(..))
5656
import GHC hiding (def)
57-
import GHC.Check (runTimeVersion, compileTimeVersionFromLibdir)
57+
import GHC.Check ( VersionCheck(..), makeGhcVersionChecker )
5858
-- import GhcMonad
5959
import HIE.Bios.Cradle
6060
import HIE.Bios.Environment (addCmdOpts, makeDynFlagsAbsolute)
@@ -267,12 +267,12 @@ cradleToSessionOpts cradle file = do
267267
CradleNone -> fail "'none' cradle is not yet supported"
268268
pure opts
269269

270-
emptyHscEnv :: IO HscEnv
271-
emptyHscEnv = do
270+
emptyHscEnv :: IORef NameCache -> IO HscEnv
271+
emptyHscEnv nc = do
272272
libdir <- getLibdir
273273
env <- runGhc (Just libdir) getSession
274274
initDynLinker env
275-
pure env
275+
pure $ setNameCache nc env
276276

277277
-- Convert a target to a list of potential absolute paths.
278278
-- A TargetModule can be anywhere listed by the supplied include
@@ -295,7 +295,9 @@ setNameCache nc hsc = hsc { hsc_NC = nc }
295295
-- components mapping to the same hie,yaml file are mapped to the same
296296
-- HscEnv which is updated as new components are discovered.
297297
loadSession :: FilePath -> Action (FilePath -> Action HscEnvEq)
298-
loadSession dir = liftIO $ do
298+
loadSession dir = do
299+
nc <- ideNc <$> getShakeExtras
300+
liftIO $ do
299301
-- Mapping from hie.yaml file to HscEnv, one per hie.yaml file
300302
hscEnvs <- newVar Map.empty
301303
-- Mapping from a filepath to HscEnv
@@ -316,7 +318,7 @@ loadSession dir = liftIO $ do
316318
-- which contains both.
317319
packageSetup <- return $ \(hieYaml, cfp, opts) -> do
318320
-- Parse DynFlags for the newly discovered component
319-
hscEnv <- emptyHscEnv
321+
hscEnv <- emptyHscEnv nc
320322
(df, targets) <- evalGhcEnv hscEnv $ do
321323
setOptions opts (hsc_dflags hscEnv)
322324
dep_info <- getDependencyInfo (componentDependencies opts)
@@ -347,21 +349,19 @@ loadSession dir = liftIO $ do
347349
-- It's important to keep the same NameCache though for reasons
348350
-- that I do not fully understand
349351
print ("Making new HscEnv" ++ (show inplace))
350-
hscEnv <- case oldDeps of
351-
Nothing -> emptyHscEnv
352-
Just (old_hsc, _) -> setNameCache (hsc_NC old_hsc) <$> emptyHscEnv
352+
hscEnv <- emptyHscEnv nc
353353
newHscEnv <-
354354
-- Add the options for the current component to the HscEnv
355355
evalGhcEnv hscEnv $ do
356356
_ <- setSessionDynFlags df
357357
getSession
358358
-- Modify the map so the hieYaml now maps to the newly created
359359
-- HscEnv
360-
-- Returns:
361-
-- * The new HscEnv so it can be used to modify the
360+
-- Returns
361+
-- * the new HscEnv so it can be used to modify the
362362
-- FilePath -> HscEnv map
363-
-- * The information for the new component which caused this cache miss
364-
-- * The modified information (without -inplace flags) for
363+
-- * The information for the new component which caused this cache miss
364+
-- * The modified information (without -inplace flags) for
365365
-- existing packages
366366
pure (Map.insert hieYaml (newHscEnv, new_deps) m, (newHscEnv, head new_deps', tail new_deps'))
367367

@@ -382,7 +382,7 @@ loadSession dir = liftIO $ do
382382
let hscEnv' = hscEnv { hsc_dflags = df
383383
, hsc_IC = (hsc_IC hscEnv) { ic_dflags = df } }
384384

385-
versionMismatch <- evalGhcEnv hscEnv' checkGhcVersion
385+
versionMismatch <- checkGhcVersion
386386
henv <- case versionMismatch of
387387
Just mismatch -> return mismatch
388388
Nothing -> newHscEnvEq hscEnv' uids
@@ -590,12 +590,17 @@ getCacheDir opts = IO.getXdgDirectory IO.XdgCache (cacheDir </> opts_hash)
590590
cacheDir :: String
591591
cacheDir = "ghcide"
592592

593-
compileTimeGhcVersion :: Version
594-
compileTimeGhcVersion = $$(compileTimeVersionFromLibdir getLibdir)
593+
ghcVersionChecker :: IO VersionCheck
594+
ghcVersionChecker = $$(makeGhcVersionChecker (pure <$> getLibdir))
595595

596-
checkGhcVersion :: Ghc (Maybe HscEnvEq)
596+
checkGhcVersion :: IO (Maybe HscEnvEq)
597597
checkGhcVersion = do
598-
v <- runTimeVersion
599-
return $ if v == Just compileTimeGhcVersion
600-
then Nothing
601-
else Just GhcVersionMismatch {compileTime = compileTimeGhcVersion, runTime = v}
598+
res <- ghcVersionChecker
599+
case res of
600+
Failure err -> do
601+
putStrLn $ "Error while checking GHC version: " ++ show err
602+
return Nothing
603+
Mismatch {..} ->
604+
return $ Just GhcVersionMismatch {..}
605+
_ ->
606+
return Nothing

ghcide

Submodule ghcide updated 43 files

haskell-language-server.cabal

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ executable haskell-language-server
152152
-- which works for now.
153153
, ghc
154154
--------------------------------------------------------------
155-
, ghc-check ^>= 0.1
155+
, ghc-check >= 0.3.0.1
156156
, ghc-paths
157157
, ghcide
158158
, gitrev

stack-8.6.4.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extra-deps:
1717
- extra-1.6.21
1818
- floskell-0.10.2
1919
- fuzzy-0.1.0.0
20-
- ghc-check-0.1.0.3
20+
- ghc-check-0.3.0.1
2121
- ghc-exactprint-0.6.2 # for HaRe
2222
- ghc-lib-parser-8.10.1.20200412
2323
- ghc-lib-parser-ex-8.10.0.4
@@ -26,9 +26,7 @@ extra-deps:
2626
- haskell-lsp-0.22.0.0
2727
- haskell-lsp-types-0.22.0.0
2828
- haskell-src-exts-1.21.1
29-
# - hie-bios-0.4.0
30-
- github: mpickering/hie-bios
31-
commit: 501cc337691cc9da45ff12db46d8b3af9a2a0eda
29+
- hie-bios-0.5.0
3230
- hlint-2.2.8
3331
- hoogle-5.0.17.11
3432
- hsimport-0.11.0

stack-8.6.5.yaml

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@ packages:
77
extra-deps:
88
- ansi-terminal-0.10.2
99
- base-compat-0.11.0
10+
- brittany-0.12.1.1
11+
- butcher-1.3.3.1
1012
# - cabal-helper-1.0.0.0
1113
- github: DanielG/cabal-helper
1214
commit: 5b85a4b9e1c6463c94ffa595893ad02c9a3d2ec3
1315
- cabal-plan-0.6.2.0
1416
- clock-0.7.2
17+
- extra-1.7.1
1518
- floskell-0.10.2
16-
# - ghcide-0.1.0
17-
- extra-1.6.21
1819
- fuzzy-0.1.0.0
19-
- ghc-check-0.1.0.3
20+
# - ghcide-0.1.0
21+
- ghc-check-0.3.0.1
2022
- ghc-lib-parser-8.10.1.20200412
2123
- ghc-lib-parser-ex-8.10.0.4
2224
- haddock-library-1.8.0
2325
- haskell-lsp-0.22.0.0
2426
- haskell-lsp-types-0.22.0.0
25-
# - hie-bios-0.4.0
26-
- github: mpickering/hie-bios
27-
commit: f0abff9c855ea7e6624617df669825f3f62f723b
27+
- hie-bios-0.5.0
2828
- indexed-profunctors-0.1
2929
- lsp-test-0.10.3.0
3030
- monad-dijkstra-0.1.1.2
@@ -36,9 +36,9 @@ extra-deps:
3636
- regex-base-0.94.0.0
3737
- regex-pcre-builtin-0.95.1.1.8.43
3838
- regex-tdfa-1.3.1.0
39+
- semialign-1.1
3940
- github: wz1000/shake
4041
commit: fb3859dca2e54d1bbb2c873e68ed225fa179fbef
41-
- semialign-1.1
4242
- tasty-rerun-1.1.17
4343
- temporary-1.2.1.1
4444
- topograph-1

stack-8.8.2.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@ extra-deps:
1414
- constrained-dynamic-0.1.0.0
1515
- floskell-0.10.2
1616
# - ghcide-0.1.0
17-
- ghc-check-0.1.0.3
17+
- ghc-check-0.3.0.1
1818
- ghc-lib-parser-8.10.1.20200412
1919
- ghc-lib-parser-ex-8.10.0.4
2020
- haddock-library-1.8.0
2121
- haskell-lsp-0.22.0.0
2222
- haskell-lsp-types-0.22.0.0
2323
- haskell-src-exts-1.21.1
24-
# - hie-bios-0.4.0
25-
- github: mpickering/hie-bios
26-
commit: 501cc337691cc9da45ff12db46d8b3af9a2a0eda
24+
- hie-bios-0.5.0
2725
- hlint-2.2.8
2826
- hoogle-5.0.17.11
2927
- hsimport-0.11.0

stack-8.8.3.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@ extra-deps:
1414
- constrained-dynamic-0.1.0.0
1515
- floskell-0.10.2
1616
# - ghcide-0.1.0
17-
- ghc-check-0.1.0.3
17+
- ghc-check-0.3.0.1
1818
- ghc-lib-parser-8.10.1.20200412
1919
- ghc-lib-parser-ex-8.10.0.4
2020
- haddock-library-1.8.0
2121
- haskell-lsp-0.22.0.0
2222
- haskell-lsp-types-0.22.0.0
2323
- haskell-src-exts-1.21.1
24-
# - hie-bios-0.4.0
25-
- github: mpickering/hie-bios
26-
commit: 501cc337691cc9da45ff12db46d8b3af9a2a0eda
24+
- hie-bios-0.5.0
2725
- hlint-2.2.8
2826
- hoogle-5.0.17.11
2927
- hsimport-0.11.0

stack.yaml

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,24 @@ packages:
77
extra-deps:
88
- ansi-terminal-0.10.2
99
- base-compat-0.11.0
10+
- brittany-0.12.1.1
11+
- butcher-1.3.3.1
1012
# - cabal-helper-1.0.0.0
1113
- github: DanielG/cabal-helper
1214
commit: 5b85a4b9e1c6463c94ffa595893ad02c9a3d2ec3
1315
- cabal-plan-0.6.2.0
1416
- clock-0.7.2
17+
- extra-1.7.1
1518
- floskell-0.10.2
1619
- fuzzy-0.1.0.0
1720
# - ghcide-0.1.0
18-
- ghc-check-0.1.0.3
21+
- ghc-check-0.3.0.1
1922
- ghc-lib-parser-8.10.1.20200412
2023
- ghc-lib-parser-ex-8.10.0.4
2124
- haddock-library-1.8.0
2225
- haskell-lsp-0.22.0.0
2326
- haskell-lsp-types-0.22.0.0
24-
# - hie-bios-0.4.0
25-
- github: mpickering/hie-bios
26-
commit: 501cc337691cc9da45ff12db46d8b3af9a2a0eda
27+
- hie-bios-0.5.0
2728
- indexed-profunctors-0.1
2829
- lsp-test-0.10.3.0
2930
- monad-dijkstra-0.1.1.2

0 commit comments

Comments
 (0)