-
Notifications
You must be signed in to change notification settings - Fork 97
Move session loading logic into ghcide library #697
Conversation
a9a9aae
to
ce91422
Compare
Some caveats of using a private lib:
Still this could be a preliminary step before convert it in a package, but the transition should be done asap, imo. |
ce91422
to
b2aa75a
Compare
@jneira just before I read your comment I found out that I forgot to add the |
@jneira ok right off the bat haskell-language-server fails to build with
|
Mmm i thought public libraries was not fully supported in cabal-install but the final pr has been recently merged, so it would need cabal-3.4 (and hoping not to hit more bugs). We will have to wait a while to have stack support. |
f5cd1d3
to
899111d
Compare
@bubba what do you think about creating directly a new subpackage (ghcide-session-loader? ghcide-bios?) with the same contents as the public library? |
899111d
to
f9e3f1d
Compare
@jneira I think a sub-package is probably overkill for just one module. With sub packages you need to be careful whenever you're making releases on hackage etc. so that you don't upload them in the wrong order. I always mess that up with |
I think ghcide maintainers preferred to separate hie-bios from the ghcide main lib, to not leak it to daml. |
@jneira ah if thats the case then, then we might not have much choice |
@bubba Other alternative would be move the ghc session logic to hls and remove the exe part from ghcide entirely, letting it be a pure lib 😄 |
@bubba @jneira Can you enumerate all the options and their tradeoffs? Things to consider:
Hopefully making it easy for the code owners (@digitalasset @cocreature) to pick one. |
That breaks all tests we currently have.
Yes, we need to be able to build ghcide (the library) without a dependency on any Haskell build tool stuff which includes hie-bios. What could work is to just hide the session stuff and the dependency on hie-bios behind a cabal flag. |
|
cabal flags have a default. Apart from DAML nobody cares about being able to disable this so the sane option is to include it by default. We could even just reuse the |
@cocreature I was thinking that as well, if the default was to include hie-bios/the session loader then haskell-language-server might still be able to get uploaded to hackage eventually. I'm happy to try out this option |
I think there would not be such circularity cause one package depends on the lib of the another one, no on its executables (they are private for dependency management purpose). That said, agree a cabal flag with the default value would be the best option. Not sure about how can it affect the ghcide executable, it will be no buildable with the session loader disabled (so maybe simply mark it as |
f9e3f1d
to
cce9b29
Compare
I didn't realise stack/cabal could handle that! @cocreature @jneira for now I've just reused the ghc-lib flag which I was already using as a check. The ghcide executable has |
f1e85e1
to
e2809d5
Compare
This way haskell-language-server can also reuse this logic. Note that this sublibrary is public so it requires cabal-version: 3.0 Part of the work towards #478
e2809d5
to
f6880a5
Compare
da6000b
to
16a85ae
Compare
Argh this module fails to build only on windows when building with stack and ghc-8.10. Window + cabal + ghc-8.10 seems fine. Not exactly sure what's causing it |
Looks like the template-haskell bit used to generate the |
efbfa13
to
e1fcb75
Compare
Sublibraries do not seem to play well. Hide this behind the ghc-lib flag so that the Haskell specific hie-bios stuff can be disabled Note that we need to put the template-haskell part of this module into a separate module because of an access exception when compiling with Stack, GHC 8.10.1 and Windows.
e1fcb75
to
e04f298
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @bubba, thank you very much!
* Split out the session loading logic into a sublibrary This way haskell-language-server can also reuse this logic. Note that this sublibrary is public so it requires cabal-version: 3.0 Part of the work towards haskell/ghcide#478 * Move Development.IDE.Session into ghcide itself Sublibraries do not seem to play well. Hide this behind the ghc-lib flag so that the Haskell specific hie-bios stuff can be disabled Note that we need to put the template-haskell part of this module into a separate module because of an access exception when compiling with Stack, GHC 8.10.1 and Windows.
* Split out the session loading logic into a sublibrary This way haskell-language-server can also reuse this logic. Note that this sublibrary is public so it requires cabal-version: 3.0 Part of the work towards haskell/ghcide#478 * Move Development.IDE.Session into ghcide itself Sublibraries do not seem to play well. Hide this behind the ghc-lib flag so that the Haskell specific hie-bios stuff can be disabled Note that we need to put the template-haskell part of this module into a separate module because of an access exception when compiling with Stack, GHC 8.10.1 and Windows.
* Split out the session loading logic into a sublibrary This way haskell-language-server can also reuse this logic. Note that this sublibrary is public so it requires cabal-version: 3.0 Part of the work towards haskell/ghcide#478 * Move Development.IDE.Session into ghcide itself Sublibraries do not seem to play well. Hide this behind the ghc-lib flag so that the Haskell specific hie-bios stuff can be disabled Note that we need to put the template-haskell part of this module into a separate module because of an access exception when compiling with Stack, GHC 8.10.1 and Windows.
This way haskell-language-server can reuse it without having to maintain two versions of this session setup code, which was getting quite tricky to maintain. Needs #693 and #696 merged first