Skip to content

Using haskell-language-server without editor integration? #712

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

Closed
mpickering opened this issue Sep 23, 2019 · 10 comments
Closed

Using haskell-language-server without editor integration? #712

mpickering opened this issue Sep 23, 2019 · 10 comments
Labels

Comments

@mpickering
Copy link
Contributor

I would be interested to use ghcide without any editor integration just to get fast error/warning display.

Would it be possible to implement some amalgamation of ghcid and ghcide? Perhaps a simple mode would just just watch the files in the loaded components and trigger a reload if any of them changed.

@ndmitchell
Copy link
Collaborator

ndmitchell commented Sep 23, 2019

It should be pretty easy to do. You add a method to IdeState to grab all the rules with a given key (very easy since that's the way it's stored), then setup IdeState, and grab the GetModificationTime and GetFileExists rules, grab the associated files, and watch them. If anything changes, just rerun the thing from scratch. Should be < 200 lines of code for something simple. Note that ghcid has stuff which nicely formats the problem pane. You'll need to replicate something along those lines, but it's much easier than ghcid has it since the data is in the right format already.

However, my question would be why? Ghcid is rock solid and well tested. It's probably faster with Ghcide, and there are a huge number of Ghci bugs that go unfixed that are mostly fixed in Ghcide. But it's less compatible and more tied to GHC version.

If you do want to do it though, happy to give whatever advice is required.

@mpickering
Copy link
Contributor Author

The main reason is that it will work properly with multiple components, when that's implemented. I think the response time is also quite a bit faster than GHCi?

@ndmitchell
Copy link
Collaborator

I have not benchmarked, but it should be faster, but I don't know whether we are talking 1.1x or 10x faster. I always solve multiple components with a custom .ghci file for ghcid, just like I use a custom direct hie.yaml for ghcide.

@mpickering
Copy link
Contributor Author

I started implementing this https://github.com/mpickering/reflex-ghcide

@ndmitchell
Copy link
Collaborator

Sweet! Any chance you can detail how to use it in the README? That it seems worth linking to from ghcide.

@mpickering
Copy link
Contributor Author

Once it is usable then I will make a PR. At the moment the user interface is very minimal.

@mitchellwrosen
Copy link

I always solve multiple components with a custom .ghci file for ghcid, just like I use a custom direct hie.yaml for ghcide.

@ndmitchell if you or anyone has time to write up how one might go about doing this, it would be much appreciated :)

@ndmitchell
Copy link
Collaborator

@mitchellwrosen - a global cabal v1 install, different names for every module in the project (using e.g. -main-is for two main entry points), and then a little magic to make everything glue together. You can see it in any of my projects, e.g. https://github.com/ndmitchell/shake/blob/master/hie.yaml - note I set the include paths and load the main modules, and everything works.

Not sure it's worth writing up properly though since the global install seems strongly discouraged (which is fine, but it's still how ghc itself thinks of the world, and thus gives way nicer tooling).

@cocreature
Copy link
Contributor

the .ghc.environment.* files that cabal writes out should be picked up which provides an option without globally installing packages. Anyway, this is completely separate from this issue so let’s please not mix this up.

@jneira jneira transferred this issue from haskell/ghcide Dec 29, 2020
@jneira jneira changed the title Using ghcide without editor integration? Using haskell-language-server without editor integration? Dec 29, 2020
@hasufell
Copy link
Member

It seems the solution is https://github.com/mpickering/simple-language-client

If you want to provide a PR to add this project to the docs, feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants