Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit eb77dc1

Browse files
committed
Merge branch 'master' into hare-hie-plugin-api
2 parents 54a8b61 + 9ac8e76 commit eb77dc1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1799
-274
lines changed

.circleci/config.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ jobs:
146146
- STACK_FILE: "stack-8.6.4.yaml"
147147
<<: *defaults
148148

149+
ghc-8.6.5:
150+
environment:
151+
- STACK_FILE: "stack-8.6.5.yaml"
152+
<<: *defaults
153+
149154
ghc-nightly:
150155
environment:
151156
- STACK_FILE: "stack.yaml"
@@ -196,7 +201,8 @@ workflows:
196201
- ghc-8.4.4
197202
- ghc-8.6.1
198203
- ghc-8.6.2
199-
- ghc-8.6.3
204+
# - ghc-8.6.3
200205
- ghc-8.6.4
206+
- ghc-8.6.5
201207
- ghc-nightly
202208
- cabal

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535
[submodule "submodules/floskell"]
3636
path = submodules/floskell
3737
url = https://github.com/ennocramer/floskell
38-
# url = https://github.com/alanz/floskell
38+
# url = https://github.com/alanz/floskell

Changelog.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
# 0.9.0.0
2+
3+
- GHC 8.6.5 preliminary support added via the nightly build (@alanz)
4+
- Resolver bumped, LTS 13.19 for GHC 8.6.4 (@alanz)
5+
- Add `diagnosticsOnChange` config parameter, default `True`
6+
(preserving prior hie behaviour). Setting it `False` only generates
7+
diagnostics on file save. ([#1164](https://github.com/haskell/haskell-ide-engine/pull/1164), @mpickering/@lorenzo)
8+
- The `Hsimport` plugin now formats the resulting change using the
9+
formatter configured for hie. ([#1167](https://github.com/haskell/haskell-ide-engine/pull/1167),@fendor)
10+
- Actually enable type definition requests, if supported by the client
11+
(e.g. vscode). ([#1169](https://github.com/haskell/haskell-ide-engine/pull/1169)/@fendor, [#1172](https://github.com/haskell/haskell-ide-engine/pull/1172)/@bubba)
12+
- Use LSP MarkupContent for generated documentation ([#1181](https://github.com/haskell/haskell-ide-engine/pull/1181), @alanz)
13+
- remove installation of Cabal by cabal ([#1184](https://github.com/haskell/haskell-ide-engine/pull/1184), @power-fungus)
14+
- Add EmptyDataDecls to available pragmas, for generating code actions
15+
to insert if needed. ([#1187](https://github.com/haskell/haskell-ide-engine/pull/1187),@fendor)
16+
- Make sure the end of formatted text is properly indicated for marked
17+
up documentation ([#1189](https://github.com/haskell/haskell-ide-engine/pull/1189), @alanz)
18+
- Fix some of the tests with cabal new-build ([#1194](https://github.com/haskell/haskell-ide-engine/pull/1194), @michaelpj)
19+
- Update build-tool-depends for func-test ([#1198](https://github.com/haskell/haskell-ide-engine/pull/1198), @bubba)
20+
- Fix version of lsp-test so `cabal new-build` works ([#1211](https://github.com/haskell/haskell-ide-engine/pull/1211), @power-fungus)
21+
- Bump hlint to 2.1.17 ([#1213](https://github.com/haskell/haskell-ide-engine/pull/1213), @alanz)
22+
- Use cabal helper that searches with exe extension on windows ([#1217](https://github.com/haskell/haskell-ide-engine/pull/1217), @alanz)
23+
24+
- Stability improvements
25+
- Avoid crash in case of nonsensical hoogle db ([#1174](https://github.com/haskell/haskell-ide-engine/pull/1174), @fendor)
26+
- Prevent hie crash if apply-refact crashes ([#1220](https://github.com/haskell/haskell-ide-engine/pull/1220), @Hogeyama)
27+
28+
- Documentation improvements
29+
- Improve code documentation about formatters ([#1165](https://github.com/haskell/haskell-ide-engine/pull/1165),@fendor)
30+
- Add code documentation for the Hoogle plugin ([#1173](https://github.com/haskell/haskell-ide-engine/pull/1173),@fendor)
31+
- Change 'build-docs' to 'build-doc' in README ([#1185](https://github.com/haskell/haskell-ide-engine/pull/1185), @ajeetdsouza)
32+
- README Nix - replace old.postFixup -> postFixup ([#1193](https://github.com/haskell/haskell-ide-engine/pull/1193), @backuitist)
33+
- Expand documentation on the build system ([#1200](https://github.com/haskell/haskell-ide-engine/pull/1200), @power-fungus)
34+
- Fixed a typo. ([#1212](https://github.com/haskell/haskell-ide-engine/pull/1212), @rashadg1030)
35+
- Add documentation about building hie with profiling
36+
enabled. ([#1225](https://github.com/haskell/haskell-ide-engine/pull/1225), @skress)
37+
- Add Documentation for Pragmas Plugin ([#1222](https://github.com/haskell/haskell-ide-engine/pull/1222), @fendor)
38+
39+
- Build system improvements
40+
- Further improvements and simplification of the `./install.hs`
41+
build system ([#1168](https://github.com/haskell/haskell-ide-engine/pull/1168), @power-fungus)
42+
143
# 0.8.0.0
244

345
- GHC 8.6.4 support added.

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ we talk to clients.__
5959
- [Is \<package\> base-x?](#is-package-base-x)
6060
- [Is there a hash (#) after \<package\>?](#is-there-a-hash--after-package)
6161
- [Otherwise](#otherwise)
62+
- [Nix: cabal-helper, No such file or directory](#nix-cabal-helper-no-such-file-or-directory)
6263

6364
## Features
6465

@@ -597,3 +598,16 @@ Delete any `.ghc.environment*` files in your project root and try again. (At the
597598

598599
#### Otherwise
599600
Try running `cabal update`.
601+
602+
### Nix: cabal-helper, No such file or directory
603+
604+
An error on stderr like
605+
606+
```
607+
cabal-helper-wrapper: /home/<...>/.cache/cabal-helper/cabal-helper<...>: createProcess: runInteractiveProcess:
608+
exec: does not exist (No such file or directory)
609+
```
610+
611+
can happen because cabal-helper compiles and runs above executable at runtime without using nix-build, which means a Nix garbage collection can delete the paths it depends on. Delete ~/.cache/cabal-helper and restart HIE to fix this.
612+
613+

docs/Build.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,37 @@ Installing `hie` is a multi-step process:
5454

5555
This ensures that a complete install is always possible after each `git pull` or a `git clone`.
5656

57+
#### Building `hie` with profiling support
58+
59+
To build `hie` with profiling enabled `cabal new-install` needs to be used instead of `stack`.
60+
61+
Configure `cabal` to enable profiling by setting `profiling: True` in `cabal.project.local` for all packages. If that file does not already exist, create it as follows:
62+
63+
```bash
64+
cat << EOF > cabal.project.local
65+
package *
66+
profiling: True
67+
EOF
68+
```
69+
70+
Then `hie` can be compiled for a specific GHC version:
71+
72+
```bash
73+
export GHCP=<path-to-ghc-binary>
74+
cabal new-install exe:hie -w $GHCP \
75+
--write-ghc-environment-files=never --symlink-bindir=$HOME/.local/bin \
76+
--overwrite-policy=always --reinstall
77+
```
78+
79+
The final step is to configure the `hie` client to use a custom `hie-wrapper` script that enables the runtime options for profiling. Such a script could look like this:
80+
81+
```bash
82+
#!/bin/sh
83+
~/.local/bin/hie-wrapper "$@" +RTS -xc
84+
```
85+
86+
(Note: If no profiling information is shown when using `hie` with a certain project, it may help to build that project itself with profiling support, e.g. `stack build --profile`.)
87+
5788
### Safety checks
5889

5990
The `install.hs` script performs some checks to ensure that a correct installation is possible and provide meaningful error messages for known issues.

haskell-ide-engine.cabal

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: haskell-ide-engine
2-
version: 0.8.0.0
2+
version: 0.9.0.0
33
synopsis: Provide a common engine to power any Haskell IDE
44
description: Please see README.md
55
homepage: http://github.com/githubuser/haskell-ide-engine#readme
@@ -70,14 +70,15 @@ library
7070
, gitrev >= 1.1
7171
, haddock-api
7272
, haddock-library
73-
, haskell-lsp == 0.9.*
74-
, haskell-lsp-types == 0.9.*
73+
, haskell-lsp == 0.11.*
74+
, haskell-lsp-types == 0.11.*
7575
, haskell-src-exts
7676
, hie-plugin-api
7777
, hlint >= 2.0.11
7878
, hoogle >= 5.0.13
7979
, hsimport
8080
, hslogger
81+
, lifted-async
8182
, lens >= 4.15.2
8283
, monad-control
8384
, monoid-subclasses > 0.4
@@ -189,7 +190,7 @@ test-suite unit-test
189190
, filepath
190191
, free
191192
, haskell-ide-engine
192-
, haskell-lsp-types >= 0.4
193+
, haskell-lsp-types
193194
, hie-test-utils
194195
, hie-plugin-api
195196
, hoogle > 5.0.11
@@ -264,6 +265,7 @@ test-suite func-test
264265
, HaReSpec
265266
, HighlightSpec
266267
, HoverSpec
268+
, ProgressSpec
267269
, ReferencesSpec
268270
, RenameSpec
269271
, SymbolsSpec
@@ -274,15 +276,17 @@ test-suite func-test
274276
, data-default
275277
, directory
276278
, filepath
277-
, lsp-test >= 0.5.1.1 && < 0.5.2
279+
, lsp-test >= 0.5.2
278280
, haskell-ide-engine
279-
, haskell-lsp-types >= 0.4
281+
, haskell-lsp-types == 0.11.*
282+
, haskell-lsp == 0.11.*
280283
, hie-test-utils
281284
, hie-plugin-api
282285
, hspec
283286
, lens
284287
, text
285288
, unordered-containers
289+
, containers
286290
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wredundant-constraints
287291
if flag(pedantic)
288292
ghc-options: -Werror

hie-plugin-api/Haskell/Ide/Engine/ArtifactMap.hs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import GHC (TypecheckedModule)
1010
import qualified SrcLoc as GHC
1111
import qualified Var
1212
import qualified GhcMod.Gap as GM
13-
import GhcMod.SrcUtils
1413

1514
import Language.Haskell.LSP.Types
1615

@@ -33,15 +32,6 @@ genIntervalMap ts = foldr go IM.empty ts
3332

3433
-- ---------------------------------------------------------------------
3534

36-
genTypeMap :: GHC.GhcMonad m => TypecheckedModule -> m TypeMap
37-
genTypeMap tm = do
38-
ts <- collectAllSpansTypes True tm
39-
return $ foldr go IM.empty ts
40-
where
41-
go (GHC.RealSrcSpan spn, typ) im =
42-
IM.insert (rspToInt spn) typ im
43-
go _ im = im
44-
4535
-- | Generates a LocMap from a TypecheckedModule,
4636
-- which allows fast queries for all the symbols
4737
-- located at a particular point in the source

hie-plugin-api/Haskell/Ide/Engine/Compat.hs

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
{-# LANGUAGE CPP #-}
2+
{-# LANGUAGE PatternSynonyms #-}
3+
{-# LANGUAGE ViewPatterns #-}
24
module Haskell.Ide.Engine.Compat where
35

6+
import qualified GHC
7+
import qualified Type
8+
import qualified TcHsSyn
9+
import qualified TysWiredIn
10+
import qualified Var
11+
412
#if MIN_VERSION_filepath(1,4,2)
513
#else
614
import Data.List
@@ -27,3 +35,108 @@ isExtensionOf :: String -> FilePath -> Bool
2735
isExtensionOf ext@('.':_) = isSuffixOf ext . takeExtensions
2836
isExtensionOf ext = isSuffixOf ('.':ext) . takeExtensions
2937
#endif
38+
39+
40+
#if MIN_VERSION_ghc(8, 4, 0)
41+
type GhcTc = GHC.GhcTc
42+
#else
43+
type GhcTc = GHC.Id
44+
#endif
45+
46+
pattern HsOverLitType :: Type.Type -> GHC.HsExpr GhcTc
47+
pattern HsOverLitType t <-
48+
#if MIN_VERSION_ghc(8, 6, 0)
49+
GHC.HsOverLit _ (GHC.overLitType -> t)
50+
#elif MIN_VERSION_ghc(8, 4, 0)
51+
GHC.HsOverLit (GHC.overLitType -> t)
52+
#else
53+
GHC.HsOverLit (GHC.overLitType -> t)
54+
#endif
55+
56+
pattern HsLitType :: Type.Type -> GHC.HsExpr GhcTc
57+
pattern HsLitType t <-
58+
#if MIN_VERSION_ghc(8, 6, 0)
59+
GHC.HsLit _ (TcHsSyn.hsLitType -> t)
60+
#elif MIN_VERSION_ghc(8, 4, 0)
61+
GHC.HsLit (TcHsSyn.hsLitType -> t)
62+
#else
63+
GHC.HsLit (TcHsSyn.hsLitType -> t)
64+
#endif
65+
66+
pattern HsLamType :: Type.Type -> GHC.HsExpr GhcTc
67+
pattern HsLamType t <-
68+
#if MIN_VERSION_ghc(8, 6, 0)
69+
GHC.HsLam _ ((\(GHC.MG { GHC.mg_ext = groupTy }) -> matchGroupType groupTy) -> t)
70+
#elif MIN_VERSION_ghc(8, 4, 0)
71+
GHC.HsLam (\GHC.MG { GHC.mg_res_ty = res, GHC.mg_arg_tys = args } -> Type.mkFunTys args res -> t)
72+
#else
73+
GHC.HsLam (\GHC.MG { GHC.mg_res_ty = res, GHC.mg_arg_tys = args } -> Type.mkFunTys args res -> t)
74+
#endif
75+
76+
pattern HsLamCaseType :: Type.Type -> GHC.HsExpr GhcTc
77+
pattern HsLamCaseType t <-
78+
#if MIN_VERSION_ghc(8, 6, 0)
79+
GHC.HsLamCase _ ((\(GHC.MG { GHC.mg_ext = groupTy }) -> matchGroupType groupTy) -> t)
80+
#elif MIN_VERSION_ghc(8, 4, 0)
81+
GHC.HsLamCase (\GHC.MG { GHC.mg_res_ty = res, GHC.mg_arg_tys = args } -> Type.mkFunTys args res -> t)
82+
#else
83+
GHC.HsLamCase (\GHC.MG { GHC.mg_res_ty = res, GHC.mg_arg_tys = args } -> Type.mkFunTys args res -> t)
84+
#endif
85+
86+
pattern HsCaseType :: Type.Type -> GHC.HsExpr GhcTc
87+
pattern HsCaseType t <-
88+
#if MIN_VERSION_ghc(8, 6, 0)
89+
GHC.HsCase _ _ ((\(GHC.MG { GHC.mg_ext = groupTy }) -> matchGroupType groupTy) -> t)
90+
#elif MIN_VERSION_ghc(8, 4, 0)
91+
GHC.HsCase _ (\GHC.MG { GHC.mg_res_ty = res, GHC.mg_arg_tys = args } -> Type.mkFunTys args res -> t)
92+
#else
93+
GHC.HsCase _ (\GHC.MG { GHC.mg_res_ty = res, GHC.mg_arg_tys = args } -> Type.mkFunTys args res -> t)
94+
#endif
95+
96+
pattern ExplicitListType :: Type.Type -> GHC.HsExpr GhcTc
97+
pattern ExplicitListType t <-
98+
#if MIN_VERSION_ghc(8, 6, 0)
99+
GHC.ExplicitList (TysWiredIn.mkListTy -> t) _ _
100+
#elif MIN_VERSION_ghc(8, 4, 0)
101+
GHC.ExplicitList (TysWiredIn.mkListTy -> t) _ _
102+
#else
103+
GHC.ExplicitList (TysWiredIn.mkListTy -> t) _ _
104+
#endif
105+
106+
pattern ExplicitSumType :: Type.Type -> GHC.HsExpr GhcTc
107+
pattern ExplicitSumType t <-
108+
#if MIN_VERSION_ghc(8, 6, 0)
109+
GHC.ExplicitSum (TysWiredIn.mkSumTy -> t) _ _ _
110+
#elif MIN_VERSION_ghc(8, 4, 0)
111+
GHC.ExplicitSum _ _ _ (TysWiredIn.mkSumTy -> t)
112+
#else
113+
GHC.ExplicitSum _ _ _ (TysWiredIn.mkSumTy -> t)
114+
#endif
115+
116+
117+
pattern HsMultiIfType :: Type.Type -> GHC.HsExpr GhcTc
118+
pattern HsMultiIfType t <-
119+
#if MIN_VERSION_ghc(8, 6, 0)
120+
GHC.HsMultiIf t _
121+
#elif MIN_VERSION_ghc(8, 4, 0)
122+
GHC.HsMultiIf t _
123+
#else
124+
GHC.HsMultiIf t _
125+
#endif
126+
127+
pattern FunBindType :: Type.Type -> GHC.HsBindLR GhcTc GhcTc
128+
pattern FunBindType t <-
129+
#if MIN_VERSION_ghc(8, 6, 0)
130+
GHC.FunBind _ (GHC.L _ (Var.varType -> t)) _ _ _
131+
#elif MIN_VERSION_ghc(8, 4, 0)
132+
GHC.FunBind (GHC.L _ (Var.varType -> t)) _ _ _ _
133+
#else
134+
GHC.FunBind (GHC.L _ (Var.varType -> t)) _ _ _ _
135+
#endif
136+
137+
138+
#if MIN_VERSION_ghc(8, 6, 0)
139+
matchGroupType :: GHC.MatchGroupTc -> GHC.Type
140+
matchGroupType (GHC.MatchGroupTc args res) = Type.mkFunTys args res
141+
#endif
142+

hie-plugin-api/Haskell/Ide/Engine/ModuleCache.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import qualified GhcMod.Utils as GM
4242
import qualified GHC as GHC
4343

4444
import Haskell.Ide.Engine.ArtifactMap
45+
import Haskell.Ide.Engine.TypeMap
4546
import Haskell.Ide.Engine.GhcModuleCache
4647
import Haskell.Ide.Engine.MultiThreadState
4748
import Haskell.Ide.Engine.PluginsIdeMonads

hie-plugin-api/Haskell/Ide/Engine/PluginUtils.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ fileInfo tfileName =
262262

263263
clientSupportsDocumentChanges :: IdeM Bool
264264
clientSupportsDocumentChanges = do
265-
ClientCapabilities mwCaps _ _ <- getClientCapabilities
265+
ClientCapabilities mwCaps _ _ _ <- getClientCapabilities
266266
let supports = do
267267
wCaps <- mwCaps
268268
WorkspaceEditClientCapabilities mDc <- _workspaceEdit wCaps
@@ -271,14 +271,14 @@ clientSupportsDocumentChanges = do
271271

272272
-- ---------------------------------------------------------------------
273273

274-
readVFS :: MonadIde m => Uri -> m (Maybe T.Text)
274+
readVFS :: (MonadIde m, MonadIO m) => Uri -> m (Maybe T.Text)
275275
readVFS uri = do
276276
mvf <- getVirtualFile uri
277277
case mvf of
278278
Just (VirtualFile _ txt) -> return $ Just (Yi.toText txt)
279279
Nothing -> return Nothing
280280

281-
getRangeFromVFS :: MonadIde m => Uri -> Range -> m (Maybe T.Text)
281+
getRangeFromVFS :: (MonadIde m, MonadIO m) => Uri -> Range -> m (Maybe T.Text)
282282
getRangeFromVFS uri rg = do
283283
mvf <- getVirtualFile uri
284284
case mvf of

0 commit comments

Comments
 (0)