rainbyte / haskell-ide-chart

Haskell state of editor/IDE support
https://rainbyte.github.io/haskell-ide-chart/
Creative Commons Attribution Share Alike 4.0 International
250 stars 12 forks source link

How about https://github.com/haskell/haskell-ide-engine? #22

Open xgrommx opened 6 years ago

xgrommx commented 6 years ago

Support for VSCode, Atom, Sublime

rainbyte commented 6 years ago

I will be able to test that plug-in soon in a few days, after exams :D

If you already have support levels, please do make a pull request.

Thanks for submitting this issue to track this!

Bargsteen commented 6 years ago

Any news? :)

rainbyte commented 6 years ago

I didn't have time to test this before (real life situation).

Now I'm trying to test HIE with vscode, just having trouble to install it (maybe GHC version related).

Will comment again after solving the HIE compat issues.

pascalpoizat commented 6 years ago

Installation and use of haskell-ide-engine-0.2.0.0

Hello

a first note on my experiments with HIE + VSC. In short : ⏳ 🔥 but then 🎉

Prelude

On a Mac. I have stack 1.7.1 installed with homebrew without cabal-install and ghc dependencies. I have no per-se installed GHC. In only build / REPL using stack (stack build, stack ghci). All the commands go in ~/.local/bin (happy, intero, hlint, hindent, etc).

Installation

❯ stack --version
Version 1.7.1 x86_64
Compiled with:
[... REMOVED ...]
Warning: this is an unsupported build that may use different versions of
dependencies and GHC than the officially released binaries, and therefore may
not behave identically.  If you encounter problems, please try the latest
official build by running 'stack upgrade --force-download'.

To install HIE I did:

git clone https://github.com/haskell/haskell-ide-engine
cd haskell-ide-engine
make build all

Note: see comment "Last note" down below. It is make build-all not make build all.

It builds a lot of things then errors at 124/201.

Process exited with code: ExitFailure 1
    Logs have been written to: /Users/pascalpoizat/Documents/Code/haskell-ide-engine/.stack-work/logs/haskell-src-exts-1.19.1.log

    Configuring haskell-src-exts-1.19.1...
    Cabal-simple_mPHDZzAJ_2.0.0.2_ghc-8.2.1: The program 'happy' version >=1.19 is
    required but it could not be found.

Then:

stack install happy
make build all

It builds and installs hie and hie-wrapper

❯ hie --version
Version 0.2.0.0, Git revision 374da0753b4c126eb71175284f0b6e551674abb6 (1515 commits) x86_64 ghc-8.2.1

~
❯ hie-wrapper --version
Version 0.2.0.0, Git revision 374da0753b4c126eb71175284f0b6e551674abb6 (1515 commits) x86_64 ghc-8.2.1

Then it goes on and build things for other LTS/GHC versions. After the first group of build things were not ok in VSC. After more (one ? more ?) it is ok.

Installation of the plugin for VSC

From https://marketplace.visualstudio.com/items?itemName=alanz.vscode-hie-server It has a dependency on the Haskell Syntax Highlighting plugin (this installs at the same time).

In the parameter of VSC change

"languageServerHaskell.useHieWrapper": false,

to

"languageServerHaskell.useHieWrapper": true,

Creation of a new project

stack new demo-hie
cd demo-hie
stack haddock --keep-going

Use of HIE in VSC on a brand new project

I did some quick experiments.

foobar' a [] = Just a foobar' a (x : xs) = foobar' x' xs where x' = max a x

- [X] formatting code (ok, apparently only if there is no error in the file)
- [X] formatting module imports (but not a fan of what Brittany does, so I use the [stylish-haskell VSC plugin](https://marketplace.visualstudio.com/items?itemName=vigoo.stylish-haskell))
- [X] renaming via HaRe (I have not tried with a big file still, with my previous VSC Haskell setup based on Haskero, F2 was very slow)

**Conclusions** 

- quite happy with this try, could possibly replace Haskero + a lot of other plugins as my VSC setup for Haskell
- I have to try on my current big project still (and see the stability wrt changing the LTS in the projects).
- I have to try HIE also with (neo)vim and spacemacs (this will not help me in doing issue #23 that is in my TODO list for a very very long time) 😞 

## Use of HIE in VSC on a older project

**TO DO**

## Last note

This long build 🔥 has stopped ⏳ .

make: *** No rule to make target `all'. Stop.



☹️ I am stupid ... it is `make build-all` not `make build all`...

It builds the things for Hoogle and remove the "no hoogle db" notification.
rainbyte commented 6 years ago

That is a really good summary about the situation @pascalpoizat . Those are really similar to the problems I'm also having here. I will update the table with this information.

HIE doesn't seem to be much compatible with currect GHC version (8.4), and I feel confused about the project GHC vs HIE GHC versions thing. It makes me think that I have to install a separated HIE almost for every project (for it to be compatible). Am I right?

Also, if I install HIE via stack, it ends up inside ~/.local/bin, but how do I know if correct version is there for my current project? (e.g. I have a project using GHC 8.0 and other using 8.4). Frontend (vscode. emacs, etc) doesn't give much info/warnings.

alanz commented 6 years ago

@rainbyte There is a makefile that builds versions of hie for all the various GHC versions, so it installs

It also installs hie-wrapper, which tried to work out what version of GHC is being used in the project, and then starts the relevant hie-* executable, provided it is on the path.

pascalpoizat commented 6 years ago

I tried HIE on a new project (see my much too long text above) + yesterday on my main project. I did not had to install HIE several times (all is in $HOME/.local/bin, with several "versions" of HIE as stated by @alanz ).

The new project was LTS 11.14. The main one is LTS 10.7. I do not know the GHC version for each (I am a bit lost about all these "per-project" and "global" stack installations to be honest) but for both HIE was fine.

I only had a very small issue (https://github.com/haskell/haskell-ide-engine/issues/644) with lib vs test modules that @alanz helped me solve. As for now I only have:

but HIE has replaced Haskero for me for the moment under VSC. I will also see if I change from the Haskell layer in spacemacs to HIE (but I was rather thinking about going from VSC to Vim due to the lag for some actions).

rainbyte commented 6 years ago

@alanz @pascalpoizat first, thanks for the time invested on this.

It seems I misunderstood the install instructions and your post above.

After reading the readme here, I thought that I had to use stack install because my test project uses GHC 8.4.3, to later find that it doesn't work for other projects with other GHC version (I suppose because in my computer I have only hie, hie-wrapper and hie-vscode inside ~/.local/bin)

Maybe it would be cool to warn the user about that in the install docs. Something like this would be useful:

Warning! Beware:

  • For multiples GHC versions compat you must use make build-all (this is the recommended approach)
  • Steps for an specific GHC version only work for that single version.

Note: you should generate the wrapper each time there is a new GHC version!

Other option to improve user experience would be to install HIE per project (like intero does) or just to build every supported GHC version by default with stack install (with opt out for users which want single version).

rainbyte commented 6 years ago

Also, I didn't say it above, but my first choice was using the HIE Archlinux version on AUR (which seems to be broken now).

Broken or not, it can be noted by reading the PKGBUILD, that it is being built for just a single GHC version (via stack build instead of make build-all).

By that I can conclude that this misunderstanding could be happening to other users and packagers.

varosi commented 6 years ago

Stack has an option to install in GHC specific location for different versions. Try stack build hie —copy-compiler-tool then stack exec — hie Will execute the correct one

rainbyte commented 6 years ago

@varosi , thanks for the advice. If used that way could it be accessed easily from e.g. vscode? It would be cool to have an obvious preparation, if possible just "install and forget about it".

rainbyte commented 6 years ago

After trying again with make build-all, it doesn't work for me. Reported issue with error output, here.

pascalpoizat commented 6 years ago

New: hie 0.2.1.0 now supports split case.