Skip to content

Commit bc5ff6f

Browse files
authored
Merge pull request haskell#8 from fendor/merge-hie-bios
Merge master downstream and update hie-bios
2 parents 373a474 + 794aa9a commit bc5ff6f

Some content is hidden

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

73 files changed

+2254
-1167
lines changed

.azure/linux-stack.yml

+23-2
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,30 @@ jobs:
2525
YAML_FILE: stack-8.4.2.yaml
2626
stack-8.2.2:
2727
YAML_FILE: stack-8.2.2.yaml
28+
variables:
29+
STACK_ROOT: /home/vsts/.stack
2830
steps:
31+
- task: CacheBeta@0
32+
inputs:
33+
key: |
34+
"cache"
35+
$(Agent.OS)
36+
$(Build.SourcesDirectory)/$(YAML_FILE)
37+
path: .azure-cache
38+
cacheHitVar: CACHE_RESTORED
39+
displayName: "Download cache"
40+
- bash: |
41+
mkdir -p $STACK_ROOT
42+
tar -xzf .azure-cache/stack-root.tar.gz -C /
43+
mkdir -p .stack-work
44+
tar -xzf .azure-cache/stack-work.tar.gz
45+
displayName: "Unpack cache"
46+
condition: eq(variables.CACHE_RESTORED, 'true')
2947
- bash: |
3048
git submodule sync
3149
git submodule update --init
3250
displayName: Sync submodules
3351
- bash: |
34-
export STACK_ROOT="$(Build.SourcesDirectory)"/.stack-root
3552
mkdir -p ~/.local/bin
3653
curl -L https://get.haskellstack.org/stable/linux-x86_64.tar.gz | \
3754
tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
@@ -52,7 +69,6 @@ jobs:
5269
source .azure/linux.bashrc
5370
stack build --stack-yaml $(YAML_FILE) --test --bench --only-dependencies
5471
stack install --stack-yaml $(YAML_FILE) # `hie` binary required for tests
55-
stack --stack-yaml $(YAML_FILE) exec hoogle generate
5672
displayName: Build Test-dependencies
5773
- bash: |
5874
sudo apt update
@@ -66,3 +82,8 @@ jobs:
6682
# source .azure/linux.bashrc
6783
# stack test --stack-yaml $(YAML_FILE)
6884
# displayName: Run Test
85+
- bash: |
86+
mkdir -p .azure-cache
87+
tar -czf .azure-cache/stack-root.tar.gz $STACK_ROOT
88+
tar -czf .azure-cache/stack-work.tar.gz .stack-work
89+
displayName: "Pack cache"

.azure/macos-stack.yml

+23-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,30 @@ jobs:
2121
YAML_FILE: stack-8.4.2.yaml
2222
stack-8.2.2:
2323
YAML_FILE: stack-8.2.2.yaml
24+
variables:
25+
STACK_ROOT: /Users/vsts/.stack
2426
steps:
27+
- task: CacheBeta@0
28+
inputs:
29+
key: |
30+
"cache"
31+
$(Agent.OS)
32+
$(Build.SourcesDirectory)/$(YAML_FILE)
33+
path: .azure-cache
34+
cacheHitVar: CACHE_RESTORED
35+
displayName: "Download cache"
36+
- bash: |
37+
mkdir -p $STACK_ROOT
38+
tar -xzf .azure-cache/stack-root.tar.gz -C /
39+
mkdir -p .stack-work
40+
tar -xzf .azure-cache/stack-work.tar.gz
41+
displayName: "Unpack cache"
42+
condition: eq(variables.CACHE_RESTORED, 'true')
2543
- bash: |
2644
git submodule sync
2745
git submodule update --init
2846
displayName: Sync submodules
2947
- bash: |
30-
export STACK_ROOT="$(Build.SourcesDirectory)"/.stack-root
3148
mkdir -p ~/.local/bin
3249
curl -skL https://get.haskellstack.org/stable/osx-x86_64.tar.gz | \
3350
tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin;
@@ -48,7 +65,6 @@ jobs:
4865
source .azure/macos.bashrc
4966
stack build --stack-yaml $(YAML_FILE) --test --bench --only-dependencies
5067
stack install --stack-yaml $(YAML_FILE) # `hie` binary required for tests
51-
stack --stack-yaml $(YAML_FILE) exec hoogle generate
5268
displayName: Build Test-dependencies
5369
- bash: |
5470
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@@ -63,3 +79,8 @@ jobs:
6379
# source .azure/macos.bashrc
6480
# stack test --stack-yaml $(YAML_FILE)
6581
# displayName: Run Test
82+
- bash: |
83+
mkdir -p .azure-cache
84+
tar -czf .azure-cache/stack-root.tar.gz $STACK_ROOT
85+
tar -czf .azure-cache/stack-work.tar.gz .stack-work
86+
displayName: "Pack cache"

.azure/windows-stack.yml

+19-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,26 @@ jobs:
2323
YAML_FILE: stack-8.4.2.yaml
2424
stack-8.2.2:
2525
YAML_FILE: stack-8.2.2.yaml
26+
variables:
27+
STACK_ROOT: "C:\\sr"
28+
2629
steps:
30+
- task: CacheBeta@0
31+
inputs:
32+
key: |
33+
"stack-root"
34+
$(Agent.OS)
35+
$(Build.SourcesDirectory)/$(YAML_FILE)
36+
path: $(STACK_ROOT)
37+
displayName: "Cache stack-root"
38+
- task: CacheBeta@0
39+
inputs:
40+
key: |
41+
"stack-work"
42+
$(Agent.OS)
43+
$(Build.SourcesDirectory)/$(YAML_FILE)
44+
path: .stack-work
45+
displayName: "Cache stack-work"
2746
- bash: |
2847
git submodule sync
2948
git submodule update --init
@@ -48,7 +67,6 @@ jobs:
4867
source .azure/windows.bashrc
4968
stack build --stack-yaml $(YAML_FILE) --test --bench --only-dependencies
5069
stack install --stack-yaml $(YAML_FILE) # `hie` binary required for tests
51-
stack exec --stack-yaml $(YAML_FILE) hoogle generate
5270
displayName: Build Test-dependencies
5371
- bash: |
5472
# TODO: try to install automatically (`choco install z3` fails and pacman is not installed)

.azure/windows.bashrc

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export STACK_ROOT="C:\\sr"
21
export LOCAL_BIN_PATH=$(cygpath $APPDATA\\local\\bin)
32
export Z3_BIN_PATH=/usr/local/z3-4.8.5-x64-win/bin
43
export PATH=$Z3_BIN_PATH:$LOCAL_BIN_PATH:$PATH

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,6 @@ _build/
7474
# stack 2.1 stack.yaml lock files
7575
stack*.yaml.lock
7676
shake.yaml.lock
77+
78+
# ignore hie.yaml's for testdata
79+
test/**/*.yaml

.gitmodules

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
# url = https://github.com/arbor/ghc-mod.git
2727
url = https://github.com/alanz/ghc-mod.git
2828
#url = https://github.com/mpickering/ghc-mod.git
29+
2930
[submodule "hie-bios"]
3031
path = hie-bios
31-
url = https://github.com/mpickering/hie-bios
32+
url = https://github.com/mpickering/hie-bios.git
33+
branch = multi-cradle

Changelog.md

+55
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,58 @@
1+
# 0.12.0.0
2+
3+
- Monthly resolver bump, `lts-13.30` for GHC 8.6.5, and `nightly-2019-07-31` for
4+
nightly build, rest are unchanged.
5+
([#1352](https://github.com/haskell/haskell-ide-engine/pull/1352), by @alanz)
6+
7+
- Log OS in hie-wrapper
8+
([#1351](https://github.com/haskell/haskell-ide-engine/pull/1351), by @chrismwendt)
9+
10+
- Fix completionItem/resolve sending snippets as plain text
11+
([#1349](https://github.com/haskell/haskell-ide-engine/pull/1349), by @Avi-D-coder)
12+
13+
- Bump hlint to 2.2.2
14+
([#1347](https://github.com/haskell/haskell-ide-engine/pull/1347), by @alanz)
15+
16+
- fail installation if cabal-version is too low
17+
([#1344](https://github.com/haskell/haskell-ide-engine/pull/1344), by @power-fungus)
18+
19+
- Update vim links in TOC
20+
([#1341](https://github.com/haskell/haskell-ide-engine/pull/1341), by @adamse)
21+
22+
- lift required stack-version to 2.1.1
23+
([#1338](https://github.com/haskell/haskell-ide-engine/pull/1338), by @power-fungus)
24+
25+
- Replace every occurrence of build-doc by build-data
26+
([#1336](https://github.com/haskell/haskell-ide-engine/pull/1336), by @w1gz)
27+
28+
- Use preview of pipeline caching in azure builds
29+
([#1335](https://github.com/haskell/haskell-ide-engine/pull/1335), by @jneira)
30+
31+
- Simpler completion
32+
([#1334](https://github.com/haskell/haskell-ide-engine/pull/1334), by @wz1000)
33+
34+
- Clarify README.md for Vim users
35+
([#1331](https://github.com/haskell/haskell-ide-engine/pull/1331), by @mb720)
36+
37+
- Fix typos in Challenges.md
38+
([#1329](https://github.com/haskell/haskell-ide-engine/pull/1329), by @mb720)
39+
40+
- Remove unnecesary extra-dep unix-time
41+
([#1326](https://github.com/haskell/haskell-ide-engine/pull/1326), by @jneira)
42+
43+
- Use hlint-2.2
44+
([#1325](https://github.com/haskell/haskell-ide-engine/pull/1325), by @alanz)
45+
46+
- Remove "hybrid" test cases
47+
([#1324](https://github.com/haskell/haskell-ide-engine/pull/1324), by @fendor)
48+
49+
- Reuse unHTML for searchModules'
50+
([#1323](https://github.com/haskell/haskell-ide-engine/pull/1323), by @fendor)
51+
52+
- add possibility to run `install.hs` from cabal
53+
([#1221](https://github.com/haskell/haskell-ide-engine/pull/1221), by @power-fungus)
54+
55+
156
# 0.11.0.0
257

358
- Bump resolvers. `lts-13.27` for GHC 8.6.5, `nightly-2019-07-07` for

README.md

+47-8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[![License BSD3][badge-license]][license]
55
[![CircleCI][badge-circleci]][circleci]
66
[![AppVeyor][badge-appveyor]][appveyor]
7+
[![Open Source Helpers](https://www.codetriage.com/haskell/haskell-ide-engine/badges/users.svg)](https://www.codetriage.com/haskell/haskell-ide-engine)
78

89
[badge-license]: https://img.shields.io/badge/license-BSD3-green.svg?dummy
910
[license]: https://github.com/haskell/haskell-ide-engine/blob/master/LICENSE
@@ -37,9 +38,11 @@ we talk to clients.__
3738
- [Using VS Code with Nix](#using-vs-code-with-nix)
3839
- [Using HIE with Sublime Text](#using-hie-with-sublime-text)
3940
- [Using HIE with Vim or Neovim](#using-hie-with-vim-or-neovim)
40-
- [vim-plug](#vim-plug)
41-
- [Vim 8.0](#vim-80)
42-
- [Sample `~/.vimrc`](#sample-vimrc)
41+
- [Coc](#Coc)
42+
- [LanguageClient-neovim](#LanguageClient-neovim)
43+
- [vim-plug](#vim-plug)
44+
- [Clone the LanguageClient-neovim repo](#clone-the-languageclient-neovim-repo)
45+
- [Sample `~/.vimrc`](#sample-vimrc)
4346
- [Using HIE with Atom](#using-hie-with-atom)
4447
- [Using HIE with Emacs](#using-hie-with-emacs)
4548
- [Using HIE with Spacemacs](#using-hie-with-spacemacs)
@@ -368,9 +371,40 @@ Now open a Haskell project with Sublime Text. You should have these features ava
368371

369372
### Using HIE with Vim or Neovim
370373

371-
As above, make sure HIE is installed. These instructions are for using the [LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim) client.
374+
As above, make sure HIE is installed.
375+
Then you can use [Coc](https://github.com/neoclide/coc.nvim), [LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim)
376+
or any other vim Langauge server protocol client.
377+
Coc is recommend since it is the only complete LSP implementation for Vim and Neovim and offers snippets and floating documentation out of the box.
378+
379+
#### Coc
380+
Follow Coc's [installation instructions](https://github.com/neoclide/coc.nvim),
381+
Then issue `:CocConfig` and add the following to your Coc config file.
382+
383+
```jsonc
384+
"languageserver": {
385+
"haskell": {
386+
"command": "hie-wrapper",
387+
"rootPatterns": [
388+
".stack.yaml",
389+
"cabal.config",
390+
"package.yaml"
391+
],
392+
"filetypes": [
393+
"hs",
394+
"lhs",
395+
"haskell"
396+
],
397+
"initializationOptions": {
398+
"languageServerHaskell": {
399+
}
400+
},
401+
}
402+
}
403+
```
404+
405+
#### LanguageClient-neovim
372406

373-
#### vim-plug
407+
##### vim-plug
374408
If you use [vim-plug](https://github.com/junegunn/vim-plug), then you can do this by e.g.,
375409
including the following line in the Plug section of your `init.vim` or `~/.vimrc`:
376410

@@ -383,11 +417,11 @@ Plug 'autozimu/LanguageClient-neovim', {
383417

384418
and issuing a `:PlugInstall` command within Neovim or Vim.
385419

386-
#### Clone the LanguageClient-neovim repo
420+
##### Clone the LanguageClient-neovim repo
387421
As an alternative to using [vim-plug](https://github.com/junegunn/vim-plug) shown above, clone [LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim)
388422
into `~/.vim/pack/XXX/start/`, where `XXX` is just a name for your "plugin suite".
389423

390-
#### Sample `~/.vimrc`
424+
##### Sample `~/.vimrc`
391425

392426
```vim
393427
set rtp+=~/.vim/pack/XXX/start/LanguageClient-neovim
@@ -625,7 +659,12 @@ These builds have a dependency on [homebrew](https://brew.sh)'s `gmp` library. I
625659
### cannot satisfy -package-id \<package\>
626660

627661
#### Is \<package\> base-x?
628-
Make sure that you are running the correct version of hie for your version of ghc, or check out hie-wrapper.
662+
Make sure that the GHC version of HIE matches the one of the project. After that run
663+
```
664+
$ cabal configure
665+
```
666+
667+
and then restart HIE (e.g. by restarting your editor).
629668

630669
#### Is there a hash (#) after \<package\>?
631670
Delete any `.ghc.environment*` files in your project root and try again. (At the time of writing, cabal new-style projects are not supported with ghc-mod)

app/HieWrapper.hs

+7-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Data.Foldable
1111
import Data.Version (showVersion)
1212
import HIE.Bios
1313
import Haskell.Ide.Engine.MonadFunctions
14+
import Haskell.Ide.Engine.Cradle (findLocalCradle)
1415
import Haskell.Ide.Engine.Options
1516
import Haskell.Ide.Engine.Plugin.Base
1617
import qualified Language.Haskell.LSP.Core as Core
@@ -20,6 +21,8 @@ import System.Directory
2021
import System.Environment
2122
import qualified System.Log.Logger as L
2223
import System.Process
24+
import System.Info
25+
import System.FilePath
2326

2427
-- ---------------------------------------------------------------------
2528

@@ -68,14 +71,15 @@ run opts = do
6871
logm $ "run entered for hie-wrapper(" ++ progName ++ ") " ++ version
6972
d <- getCurrentDirectory
7073
logm $ "Current directory:" ++ d
74+
logm $ "Operating system:" ++ os
7175

7276
-- Get the cabal directory from the cradle
73-
cr <- findCradle d
74-
let dir = cradleRootDir cr
77+
cradle <- findLocalCradle (d </> "File.hs")
78+
let dir = cradleRootDir cradle
7579
logm $ "Cradle directory:" ++ dir
7680
setCurrentDirectory dir
7781

78-
ghcVersion <- getProjectGhcVersion
82+
ghcVersion <- getProjectGhcVersion cradle
7983
logm $ "Project GHC version:" ++ ghcVersion
8084

8185
let

app/MainHie.hs

+9-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module Main where
55
import Control.Monad
66
import Data.Monoid ((<>))
77
import Data.Version (showVersion)
8+
import Haskell.Ide.Engine.Cradle (findLocalCradle)
89
import Haskell.Ide.Engine.MonadFunctions
910
import Haskell.Ide.Engine.MonadTypes
1011
import Haskell.Ide.Engine.Options
@@ -15,10 +16,11 @@ import qualified Language.Haskell.LSP.Core as Core
1516
import Options.Applicative.Simple
1617
import qualified Paths_haskell_ide_engine as Meta
1718
import System.Directory
19+
import System.FilePath ((</>))
1820
import System.Environment
1921
import qualified System.Log.Logger as L
20-
import HIE.Bios.Types
21-
import System.IO
22+
import HIE.Bios.Types
23+
import System.IO
2224

2325
-- ---------------------------------------------------------------------
2426
-- plugins
@@ -112,7 +114,11 @@ run opts = do
112114

113115
Core.setupLogger mLogFileName ["hie"] logLevel
114116

115-
projGhcVersion <- getProjectGhcVersion
117+
d <- getCurrentDirectory
118+
-- Get the cabal directory from the cradle
119+
cradle <- findLocalCradle (d </> "File.hs")
120+
121+
projGhcVersion <- getProjectGhcVersion cradle
116122
when (projGhcVersion /= hieGhcVersion) $
117123
warningm $ "Mismatching GHC versions: Project is " ++ projGhcVersion
118124
++ ", HIE is " ++ hieGhcVersion
@@ -123,7 +129,6 @@ run opts = do
123129

124130
progName <- getProgName
125131
logm $ "Run entered for HIE(" ++ progName ++ ") " ++ version
126-
d <- getCurrentDirectory
127132
logm $ "Current directory:" ++ d
128133

129134
let initOpts = defaultCradleOpts { cradleOptsVerbosity = verbosity }

0 commit comments

Comments
 (0)