tweag / gazelle_cabal

A gazelle extension to produce Haskell rules from cabal files
Apache License 2.0
13 stars 5 forks source link

HLS support #28

Open googleson78 opened 2 years ago

googleson78 commented 2 years ago

Does anyone developing this have a local HLS setup they're using? It seems like following https://rules-haskell.readthedocs.io/en/latest/haskell-use-cases.html#configuring-ide-integration-with-ghcide almost gets you there, but hls doesn't seem to be finding modules from the current package (e.g. I can't import CabalScan.Rules)

kczulko commented 2 years ago

I think I've tried sth with this but I gave up. I don't remember exactly why :)

kczulko commented 2 years ago

Small update: Ok, I've tried this now but I wanted to take hls from the nix-shell instead of building ghcide with bazel (in the end we use ghc8107 from nixpkgs here and when I've tried with ghcide bazel build... It was failing). I ended up with broken hcg-minus-0.16 for the nixpkgs we're pinned to, which is what I'm trying to fix now.

Funny thing - I though that someone already fixed that: I'll try to use this https://github.com/morganthomas/hcg-minus

edit: Oh my God... I'm so stupid... hls /= haskell-language-server

kczulko commented 2 years ago

@googleson78

I've tried this

This is what I've encountered:

After the last step, haskell-language-server-wrapper was processing files for more than 5hrs so I quit this process. I've observed that there were some errors but they only were related to .hs files from rules_haskell project (error msg was mentioning lack of //cabalscan:hie-bios target under rules_haskell project... so failure was looking obvious). For all other .hs files from all other dependencies, processing was looking good but it was terribly slow.

It looks like at least sth (lenses + code actions) is working in my case with this code (Options.hs file): image

aherrmann commented 2 years ago

It's been a long time since I last looked into this. A work HLS setup and updated documentation would be most welcome! Unfortunately, I don't have a working setup with HLS myself. (Writing from the perspective of rules_haskell)