Skip to content

Use latest mpickering hls, with hover tweaks added #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ source-repository-package
location: https://github.com/DanielG/cabal-helper.git
tag: 5b85a4b9e1c6463c94ffa595893ad02c9a3d2ec3

source-repository-package
type: git
location: https://github.com/mpickering/hie-bios.git
tag: 501cc337691cc9da45ff12db46d8b3af9a2a0eda

source-repository-package
type: git
location: https://github.com/wz1000/shake
Expand All @@ -27,4 +22,4 @@ package ghcide

write-ghc-environment-files: never

index-state: 2020-05-05T17:33:00Z
index-state: 2020-05-09T16:01:39Z
47 changes: 26 additions & 21 deletions exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import DynFlags (gopt_set, gopt_unset,
updOptLevel)
import DynFlags (PackageFlag(..), PackageArg(..))
import GHC hiding (def)
import GHC.Check (runTimeVersion, compileTimeVersionFromLibdir)
import GHC.Check ( VersionCheck(..), makeGhcVersionChecker )
-- import GhcMonad
import HIE.Bios.Cradle
import HIE.Bios.Environment (addCmdOpts, makeDynFlagsAbsolute)
Expand Down Expand Up @@ -267,12 +267,12 @@ cradleToSessionOpts cradle file = do
CradleNone -> fail "'none' cradle is not yet supported"
pure opts

emptyHscEnv :: IO HscEnv
emptyHscEnv = do
emptyHscEnv :: IORef NameCache -> IO HscEnv
emptyHscEnv nc = do
libdir <- getLibdir
env <- runGhc (Just libdir) getSession
initDynLinker env
pure env
pure $ setNameCache nc env

-- Convert a target to a list of potential absolute paths.
-- A TargetModule can be anywhere listed by the supplied include
Expand All @@ -295,7 +295,9 @@ setNameCache nc hsc = hsc { hsc_NC = nc }
-- components mapping to the same hie,yaml file are mapped to the same
-- HscEnv which is updated as new components are discovered.
loadSession :: FilePath -> Action (FilePath -> Action HscEnvEq)
loadSession dir = liftIO $ do
loadSession dir = do
nc <- ideNc <$> getShakeExtras
liftIO $ do
-- Mapping from hie.yaml file to HscEnv, one per hie.yaml file
hscEnvs <- newVar Map.empty
-- Mapping from a filepath to HscEnv
Expand All @@ -316,7 +318,7 @@ loadSession dir = liftIO $ do
-- which contains both.
packageSetup <- return $ \(hieYaml, cfp, opts) -> do
-- Parse DynFlags for the newly discovered component
hscEnv <- emptyHscEnv
hscEnv <- emptyHscEnv nc
(df, targets) <- evalGhcEnv hscEnv $ do
setOptions opts (hsc_dflags hscEnv)
dep_info <- getDependencyInfo (componentDependencies opts)
Expand Down Expand Up @@ -347,21 +349,19 @@ loadSession dir = liftIO $ do
-- It's important to keep the same NameCache though for reasons
-- that I do not fully understand
print ("Making new HscEnv" ++ (show inplace))
hscEnv <- case oldDeps of
Nothing -> emptyHscEnv
Just (old_hsc, _) -> setNameCache (hsc_NC old_hsc) <$> emptyHscEnv
hscEnv <- emptyHscEnv nc
newHscEnv <-
-- Add the options for the current component to the HscEnv
evalGhcEnv hscEnv $ do
_ <- setSessionDynFlags df
getSession
-- Modify the map so the hieYaml now maps to the newly created
-- HscEnv
-- Returns:
-- * The new HscEnv so it can be used to modify the
-- Returns
-- * the new HscEnv so it can be used to modify the
-- FilePath -> HscEnv map
-- * The information for the new component which caused this cache miss
-- * The modified information (without -inplace flags) for
-- * The information for the new component which caused this cache miss
-- * The modified information (without -inplace flags) for
-- existing packages
pure (Map.insert hieYaml (newHscEnv, new_deps) m, (newHscEnv, head new_deps', tail new_deps'))

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

versionMismatch <- evalGhcEnv hscEnv' checkGhcVersion
versionMismatch <- checkGhcVersion
henv <- case versionMismatch of
Just mismatch -> return mismatch
Nothing -> newHscEnvEq hscEnv' uids
Expand Down Expand Up @@ -590,12 +590,17 @@ getCacheDir opts = IO.getXdgDirectory IO.XdgCache (cacheDir </> opts_hash)
cacheDir :: String
cacheDir = "ghcide"

compileTimeGhcVersion :: Version
compileTimeGhcVersion = $$(compileTimeVersionFromLibdir getLibdir)
ghcVersionChecker :: IO VersionCheck
ghcVersionChecker = $$(makeGhcVersionChecker (pure <$> getLibdir))

checkGhcVersion :: Ghc (Maybe HscEnvEq)
checkGhcVersion :: IO (Maybe HscEnvEq)
checkGhcVersion = do
v <- runTimeVersion
return $ if v == Just compileTimeGhcVersion
then Nothing
else Just GhcVersionMismatch {compileTime = compileTimeGhcVersion, runTime = v}
res <- ghcVersionChecker
case res of
Failure err -> do
putStrLn $ "Error while checking GHC version: " ++ show err
return Nothing
Mismatch {..} ->
return $ Just GhcVersionMismatch {..}
_ ->
return Nothing
2 changes: 1 addition & 1 deletion ghcide
Submodule ghcide updated 43 files
+13 −0 .github/workflows/build.yaml
+1 −0 .gitignore
+2 −0 .hlint.yaml
+5 −1 README.md
+4 −1 cabal.project
+30 −24 exe/Main.hs
+142 −0 exe/Rules.hs
+12 −4 ghcide.cabal
+393 −0 src-ghc810/Development/IDE/GHC/HieBin.hs
+1,784 −0 src-ghc86/Development/IDE/GHC/HieAst.hs
+383 −0 src-ghc86/Development/IDE/GHC/HieBin.hs
+145 −0 src-ghc86/Development/IDE/GHC/HieDebug.hs
+533 −0 src-ghc86/Development/IDE/GHC/HieTypes.hs
+451 −0 src-ghc86/Development/IDE/GHC/HieUtils.hs
+383 −0 src-ghc88/Development/IDE/GHC/HieBin.hs
+14 −14 src/Development/IDE/Core/Compile.hs
+1 −2 src/Development/IDE/Core/FileStore.hs
+1 −1 src/Development/IDE/Core/OfInterest.hs
+46 −16 src/Development/IDE/Core/PositionMapping.hs
+42 −7 src/Development/IDE/Core/RuleTypes.hs
+114 −66 src/Development/IDE/Core/Rules.hs
+45 −21 src/Development/IDE/Core/Shake.hs
+44 −69 src/Development/IDE/GHC/Compat.hs
+11 −0 src/Development/IDE/GHC/Error.hs
+2 −2 src/Development/IDE/GHC/Util.hs
+21 −17 src/Development/IDE/Import/DependencyInformation.hs
+0 −1 src/Development/IDE/Import/FindImports.hs
+10 −2 src/Development/IDE/LSP/HoverDefinition.hs
+1 −0 src/Development/IDE/LSP/LanguageServer.hs
+4 −4 src/Development/IDE/LSP/Outline.hs
+2 −0 src/Development/IDE/Plugin/CodeAction.hs
+4 −3 src/Development/IDE/Plugin/Completions/Logic.hs
+83 −115 src/Development/IDE/Spans/AtPoint.hs
+0 −273 src/Development/IDE/Spans/Calculate.hs
+23 −20 src/Development/IDE/Spans/Common.hs
+25 −0 src/Development/IDE/Spans/Documentation.hs
+0 −77 src/Development/IDE/Spans/Type.hs
+2 −2 stack-ghc-lib.yaml
+3 −4 stack.yaml
+2 −1 stack810.yaml
+2 −5 stack84.yaml
+3 −5 stack88.yaml
+23 −20 test/exe/Main.hs
2 changes: 1 addition & 1 deletion haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ executable haskell-language-server
-- which works for now.
, ghc
--------------------------------------------------------------
, ghc-check ^>= 0.1
, ghc-check >= 0.3.0.1
, ghc-paths
, ghcide
, gitrev
Expand Down
6 changes: 2 additions & 4 deletions stack-8.6.4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extra-deps:
- extra-1.6.21
- floskell-0.10.2
- fuzzy-0.1.0.0
- ghc-check-0.1.0.3
- ghc-check-0.3.0.1
- ghc-exactprint-0.6.2 # for HaRe
- ghc-lib-parser-8.10.1.20200412
- ghc-lib-parser-ex-8.10.0.4
Expand All @@ -26,9 +26,7 @@ extra-deps:
- haskell-lsp-0.22.0.0
- haskell-lsp-types-0.22.0.0
- haskell-src-exts-1.21.1
# - hie-bios-0.4.0
- github: mpickering/hie-bios
commit: 501cc337691cc9da45ff12db46d8b3af9a2a0eda
- hie-bios-0.5.0
- hlint-2.2.8
- hoogle-5.0.17.11
- hsimport-0.11.0
Expand Down
14 changes: 7 additions & 7 deletions stack-8.6.5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ packages:
extra-deps:
- ansi-terminal-0.10.2
- base-compat-0.11.0
- brittany-0.12.1.1
- butcher-1.3.3.1
# - cabal-helper-1.0.0.0
- github: DanielG/cabal-helper
commit: 5b85a4b9e1c6463c94ffa595893ad02c9a3d2ec3
- cabal-plan-0.6.2.0
- clock-0.7.2
- extra-1.7.1
- floskell-0.10.2
# - ghcide-0.1.0
- extra-1.6.21
- fuzzy-0.1.0.0
- ghc-check-0.1.0.3
# - ghcide-0.1.0
- ghc-check-0.3.0.1
- ghc-lib-parser-8.10.1.20200412
- ghc-lib-parser-ex-8.10.0.4
- haddock-library-1.8.0
- haskell-lsp-0.22.0.0
- haskell-lsp-types-0.22.0.0
# - hie-bios-0.4.0
- github: mpickering/hie-bios
commit: f0abff9c855ea7e6624617df669825f3f62f723b
- hie-bios-0.5.0
- indexed-profunctors-0.1
- lsp-test-0.10.3.0
- monad-dijkstra-0.1.1.2
Expand All @@ -36,9 +36,9 @@ extra-deps:
- regex-base-0.94.0.0
- regex-pcre-builtin-0.95.1.1.8.43
- regex-tdfa-1.3.1.0
- semialign-1.1
- github: wz1000/shake
commit: fb3859dca2e54d1bbb2c873e68ed225fa179fbef
- semialign-1.1
- tasty-rerun-1.1.17
- temporary-1.2.1.1
- topograph-1
Expand Down
6 changes: 2 additions & 4 deletions stack-8.8.2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ extra-deps:
- constrained-dynamic-0.1.0.0
- floskell-0.10.2
# - ghcide-0.1.0
- ghc-check-0.1.0.3
- ghc-check-0.3.0.1
- ghc-lib-parser-8.10.1.20200412
- ghc-lib-parser-ex-8.10.0.4
- haddock-library-1.8.0
- haskell-lsp-0.22.0.0
- haskell-lsp-types-0.22.0.0
- haskell-src-exts-1.21.1
# - hie-bios-0.4.0
- github: mpickering/hie-bios
commit: 501cc337691cc9da45ff12db46d8b3af9a2a0eda
- hie-bios-0.5.0
- hlint-2.2.8
- hoogle-5.0.17.11
- hsimport-0.11.0
Expand Down
6 changes: 2 additions & 4 deletions stack-8.8.3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ extra-deps:
- constrained-dynamic-0.1.0.0
- floskell-0.10.2
# - ghcide-0.1.0
- ghc-check-0.1.0.3
- ghc-check-0.3.0.1
- ghc-lib-parser-8.10.1.20200412
- ghc-lib-parser-ex-8.10.0.4
- haddock-library-1.8.0
- haskell-lsp-0.22.0.0
- haskell-lsp-types-0.22.0.0
- haskell-src-exts-1.21.1
# - hie-bios-0.4.0
- github: mpickering/hie-bios
commit: 501cc337691cc9da45ff12db46d8b3af9a2a0eda
- hie-bios-0.5.0
- hlint-2.2.8
- hoogle-5.0.17.11
- hsimport-0.11.0
Expand Down
9 changes: 5 additions & 4 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,24 @@ packages:
extra-deps:
- ansi-terminal-0.10.2
- base-compat-0.11.0
- brittany-0.12.1.1
- butcher-1.3.3.1
# - cabal-helper-1.0.0.0
- github: DanielG/cabal-helper
commit: 5b85a4b9e1c6463c94ffa595893ad02c9a3d2ec3
- cabal-plan-0.6.2.0
- clock-0.7.2
- extra-1.7.1
- floskell-0.10.2
- fuzzy-0.1.0.0
# - ghcide-0.1.0
- ghc-check-0.1.0.3
- ghc-check-0.3.0.1
- ghc-lib-parser-8.10.1.20200412
- ghc-lib-parser-ex-8.10.0.4
- haddock-library-1.8.0
- haskell-lsp-0.22.0.0
- haskell-lsp-types-0.22.0.0
# - hie-bios-0.4.0
- github: mpickering/hie-bios
commit: 501cc337691cc9da45ff12db46d8b3af9a2a0eda
- hie-bios-0.5.0
- indexed-profunctors-0.1
- lsp-test-0.10.3.0
- monad-dijkstra-0.1.1.2
Expand Down