haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.65k stars 354 forks source link

stack cradle fails to load private lib #114

Open jneira opened 4 years ago

jneira commented 4 years ago
Avi-D-coder commented 4 years ago

Does anyone know if cabal-helper works with this?

fendor commented 4 years ago

I think it does. IIRC, when the Cradle.hs was written in HIE, I made sure that certain real world test-cases succeed. Since cabal-helper doesnt use stack repl for finding the component options, it has a higher probability of succeeding, imo. However, this needs to be fixed in stack, eventually.

Avi-D-coder commented 4 years ago

Can confirm cabal-helper is able to load this. Test repo

michaelpj commented 2 years ago

It's an upstream issue, so you'll have to ask the stack maintainers.

majkrzak commented 1 year ago

Can confirm cabal-helper is able to load this. Test repo

Any tip how exactly can it be bypassed with cabal helper?

fendor commented 1 year ago

In a previous life of HLS, cabal-helper was used to figure out project compilation options, alongside implicit-hie. Nowadays, we only use implicit-hie, and cabal-helper is no longer part of this project.

I think, it would be really difficult to use cabal-helper today. You'd need to port the code from haskell-ide-engine (https://github.com/haskell/haskell-ide-engine/blob/master/hie-plugin-api/Haskell/Ide/Engine/Cradle.hs) and port it to HLS (there have been a number of attempts, I think), or wrap cabal-helper as a bios cradle script and then try to make the correct invocations... In short, I don't think it is feasible to do either, unless you are ready to throw a lot of resources on it. And if that's the case, you'd rather should invest these resources into stack fixing the bug :)

majkrzak commented 1 year ago

I just tricked to work by manually typing the hie.yaml where i did someting liek this:

cradle:
  stack:
    - path: ./src
      component: "foo:lib"
    - path: ./lib/bar
      component: "foo:lib"

instead of

cradle:
  stack:
    - path: ./src
      component: "foo:lib"
    - path: ./lib/bar
      component: "foo:lib:bar"

as it was probably was implicitly.

Not sure how big side effect it have, but it seems to be fine at this point for me :shrug: