on master help sign in
Update to hie-bios 0.5.0 (#552)
9129475fendor
exe/RuleTypes.hs+1
@@ -14,6 +14,7 @@ type instance RuleResult GetHscEnv = HscEnvEq
14
14
15data GetHscEnv = GetHscEnv
15data GetHscEnv = GetHscEnv
16 { hscenvOptions :: [String] -- componentOptions from hie-bios
16 { hscenvOptions :: [String] -- componentOptions from hie-bios
17+ , hscenvRoot :: FilePath -- componentRoot from hie-bios
17 , hscenvDependencies :: [FilePath] -- componentDependencies from hie-bios
18 , hscenvDependencies :: [FilePath] -- componentDependencies from hie-bios
18 }
19 }
19 deriving (Eq, Show, Typeable, Generic)
20 deriving (Eq, Show, Typeable, Generic)
exe/Rules.hs+8−6
@@ -26,7 +26,7 @@ import GHC
26import GHC.Check (VersionCheck(..), makeGhcVersionChecker)
26import GHC.Check (VersionCheck(..), makeGhcVersionChecker)
27import HIE.Bios
27import HIE.Bios
28import HIE.Bios.Cradle
28import HIE.Bios.Cradle
29−import HIE.Bios.Environment (addCmdOpts)
29+import HIE.Bios.Environment (addCmdOpts, makeDynFlagsAbsolute)
30import HIE.Bios.Types
30import HIE.Bios.Types
31import Linker (initDynLinker)
31import Linker (initDynLinker)
32import RuleTypes
32import RuleTypes
@@ -55,8 +55,8 @@ loadGhcSession =
55 -- This rule is for caching the GHC session. E.g., even when the cabal file
55 -- This rule is for caching the GHC session. E.g., even when the cabal file
56 -- changed, if the resulting flags did not change, we would continue to use
56 -- changed, if the resulting flags did not change, we would continue to use
57 -- the existing session.
57 -- the existing session.
58− defineNoFile $ \(GetHscEnv opts deps) ->
58+ defineNoFile $ \(GetHscEnv opts optRoot deps) ->
59− liftIO $ createSession $ ComponentOptions opts deps
59+ liftIO $ createSession $ ComponentOptions opts optRoot deps
60
60
61cradleToSession :: Rules ()
61cradleToSession :: Rules ()
62cradleToSession = define $ \LoadCradle nfp -> do
62cradleToSession = define $ \LoadCradle nfp -> do
@@ -79,13 +79,14 @@ cradleToSession = define $ \LoadCradle nfp -> do
79 cmpOpts <- liftIO $ mask $ \_ -> getComponentOptions cradle
79 cmpOpts <- liftIO $ mask $ \_ -> getComponentOptions cradle
80 let opts = componentOptions cmpOpts
80 let opts = componentOptions cmpOpts
81 deps = componentDependencies cmpOpts
81 deps = componentDependencies cmpOpts
82+ root = componentRoot cmpOpts
82 deps' = case mbYaml of
83 deps' = case mbYaml of
83 -- For direct cradles, the hie.yaml file itself must be watched.
84 -- For direct cradles, the hie.yaml file itself must be watched.
84 Just yaml | isDirectCradle cradle -> yaml : deps
85 Just yaml | isDirectCradle cradle -> yaml : deps
85 _ -> deps
86 _ -> deps
86 existingDeps <- filterM doesFileExist deps'
87 existingDeps <- filterM doesFileExist deps'
87 need existingDeps
88 need existingDeps
88− ([],) . pure <$> useNoFile_ (GetHscEnv opts deps)
89+ ([],) . pure <$> useNoFile_ (GetHscEnv opts root deps)
89
90
90cradleLoadedMethod :: Text
91cradleLoadedMethod :: Text
91cradleLoadedMethod = "ghcide/cradle/loaded"
92cradleLoadedMethod = "ghcide/cradle/loaded"
@@ -118,7 +119,7 @@ checkGhcVersion = do
118 return Nothing
119 return Nothing
119
120
120createSession :: ComponentOptions -> IO HscEnvEq
121createSession :: ComponentOptions -> IO HscEnvEq
121−createSession (ComponentOptions theOpts _) = do
122+createSession (ComponentOptions theOpts compRoot _) = do
122 libdir <- getLibdir
123 libdir <- getLibdir
123
124
124 cacheDir <- getCacheDir theOpts
125 cacheDir <- getCacheDir theOpts
@@ -127,7 +128,8 @@ createSession (ComponentOptions theOpts _) = do
127
128
128 runGhc (Just libdir) $ do
129 runGhc (Just libdir) $ do
129 dflags <- getSessionDynFlags
130 dflags <- getSessionDynFlags
130− (dflags', _targets) <- addCmdOpts theOpts dflags
131+ (dflags_, _targets) <- addCmdOpts theOpts dflags
132+ let dflags' = makeDynFlagsAbsolute compRoot dflags_
131 setupDynFlags cacheDir dflags'
133 setupDynFlags cacheDir dflags'
132 versionMismatch <- liftIO checkGhcVersion
134 versionMismatch <- liftIO checkGhcVersion
133 case versionMismatch of
135 case versionMismatch of
ghcide.cabal+1−1
@@ -204,7 +204,7 @@ executable ghcide
204 hashable,
204 hashable,
205 haskell-lsp,
205 haskell-lsp,
206 haskell-lsp-types,
206 haskell-lsp-types,
207− hie-bios >= 0.4.0 && < 0.5,
207+ hie-bios >= 0.5.0 && < 0.6,
208 ghcide,
208 ghcide,
209 optparse-applicative,
209 optparse-applicative,
210 shake,
210 shake,
stack-ghc-lib.yaml+1−1
@@ -5,7 +5,7 @@ extra-deps:
5- haskell-lsp-0.22.0.0
5- haskell-lsp-0.22.0.0
6- haskell-lsp-types-0.22.0.0
6- haskell-lsp-types-0.22.0.0
7- lsp-test-0.10.3.0
7- lsp-test-0.10.3.0
8−- hie-bios-0.4.0
8+- hie-bios-0.5.0
9- ghc-lib-parser-8.8.1
9- ghc-lib-parser-8.8.1
10- ghc-lib-8.8.1
10- ghc-lib-8.8.1
11- fuzzy-0.1.0.0
11- fuzzy-0.1.0.0
stack.yaml+1−1
@@ -5,7 +5,7 @@ extra-deps:
5- haskell-lsp-0.22.0.0
5- haskell-lsp-0.22.0.0
6- haskell-lsp-types-0.22.0.0
6- haskell-lsp-types-0.22.0.0
7- lsp-test-0.11.0.1
7- lsp-test-0.11.0.1
8−- hie-bios-0.4.0
8+- hie-bios-0.5.0
9- fuzzy-0.1.0.0
9- fuzzy-0.1.0.0
10- regex-pcre-builtin-0.95.1.1.8.43
10- regex-pcre-builtin-0.95.1.1.8.43
11- regex-base-0.94.0.0
11- regex-base-0.94.0.0
stack810.yaml+1
@@ -8,6 +8,7 @@ extra-deps:
8- haskell-lsp-types-0.22.0.0
8- haskell-lsp-types-0.22.0.0
9- lsp-test-0.11.0.1
9- lsp-test-0.11.0.1
10- ghc-check-0.3.0.1
10- ghc-check-0.3.0.1
11+- hie-bios-0.5.0
11
12
12# for ghc-8.10
13# for ghc-8.10
13- Cabal-3.2.0.0
14- Cabal-3.2.0.0
stack84.yaml+1−1
@@ -11,7 +11,7 @@ extra-deps:
11- rope-utf16-splay-0.3.1.0
11- rope-utf16-splay-0.3.1.0
12- filepattern-0.1.1
12- filepattern-0.1.1
13- js-dgtable-0.5.2
13- js-dgtable-0.5.2
14−- hie-bios-0.4.0
14+- hie-bios-0.5.0
15- fuzzy-0.1.0.0
15- fuzzy-0.1.0.0
16- shake-0.18.5
16- shake-0.18.5
17- time-compat-1.9.2.2
17- time-compat-1.9.2.2
stack88.yaml+1−1
@@ -6,6 +6,6 @@ extra-deps:
6- haskell-lsp-types-0.22.0.0
6- haskell-lsp-types-0.22.0.0
7- lsp-test-0.11.0.1
7- lsp-test-0.11.0.1
8- ghc-check-0.3.0.1
8- ghc-check-0.3.0.1
9−
9+- hie-bios-0.5.0
10nix:
10nix:
11 packages: [zlib]
11 packages: [zlib]
test/exe/Main.hs+6−10
@@ -482,26 +482,22 @@ watchedFilesTests = testGroup "watched files"
482 _doc <- createDoc "A.hs" "haskell" "{-#LANGUAGE NoImplicitPrelude #-}\nmodule A where\nimport WatchedFilesMissingModule"
482 _doc <- createDoc "A.hs" "haskell" "{-#LANGUAGE NoImplicitPrelude #-}\nmodule A where\nimport WatchedFilesMissingModule"
483 watchedFileRegs <- getWatchedFilesSubscriptionsUntil @PublishDiagnosticsNotification
483 watchedFileRegs <- getWatchedFilesSubscriptionsUntil @PublishDiagnosticsNotification
484
484
485− -- Expect 6 subscriptions (A does not get any because it's VFS):
485+ -- Expect 4 subscriptions (A does not get any because it's VFS):
486 -- - /path-to-workspace/WatchedFilesMissingModule.hs
486 -- - /path-to-workspace/WatchedFilesMissingModule.hs
487 -- - /path-to-workspace/WatchedFilesMissingModule.lhs
487 -- - /path-to-workspace/WatchedFilesMissingModule.lhs
488− -- - WatchedFilesMissingModule.hs
489− -- - WatchedFilesMissingModule.lhs
490− -- - src/WatchedFilesMissingModule.hs
488+ -- - /path-to-workspace/src/WatchedFilesMissingModule.hs
491− -- - src/WatchedFilesMissingModule.lhs
489+ -- - /path-to-workspace/src/WatchedFilesMissingModule.lhs
492− liftIO $ length watchedFileRegs @?= 6
490+ liftIO $ length watchedFileRegs @?= 4
493
491
494 , testSession' "non workspace file" $ \sessionDir -> do
492 , testSession' "non workspace file" $ \sessionDir -> do
495 liftIO $ writeFile (sessionDir </> "hie.yaml") "cradle: {direct: {arguments: [\"-i/tmp\"]}}"
493 liftIO $ writeFile (sessionDir </> "hie.yaml") "cradle: {direct: {arguments: [\"-i/tmp\"]}}"
496 _doc <- createDoc "A.hs" "haskell" "{-# LANGUAGE NoImplicitPrelude#-}\nmodule A where\nimport WatchedFilesMissingModule"
494 _doc <- createDoc "A.hs" "haskell" "{-# LANGUAGE NoImplicitPrelude#-}\nmodule A where\nimport WatchedFilesMissingModule"
497 watchedFileRegs <- getWatchedFilesSubscriptionsUntil @PublishDiagnosticsNotification
495 watchedFileRegs <- getWatchedFilesSubscriptionsUntil @PublishDiagnosticsNotification
498
496
499− -- Expect 4 subscriptions (/tmp does not get any as it is out of the workspace):
497+ -- Expect 2 subscriptions (/tmp does not get any as it is out of the workspace):
500 -- - /path-to-workspace/WatchedFilesMissingModule.hs
498 -- - /path-to-workspace/WatchedFilesMissingModule.hs
501 -- - /path-to-workspace/WatchedFilesMissingModule.lhs
499 -- - /path-to-workspace/WatchedFilesMissingModule.lhs
502− -- - WatchedFilesMissingModule.hs
503− -- - WatchedFilesMissingModule.lhs
504− liftIO $ length watchedFileRegs @?= 4
500+ liftIO $ length watchedFileRegs @?= 2
505
501
506 -- TODO add a test for didChangeWorkspaceFolder
502 -- TODO add a test for didChangeWorkspaceFolder
507 ]
503 ]