haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 213 forks source link

Move finding the package for a filepath #1750

Closed fendor closed 4 years ago

fendor commented 4 years ago

Closes #1640

Currently, hie-wrapper uses the cradle type to find the ghc version to use on the project. Cabal-Helper does not only return the cradle type but also initialises the packages of the project, which may take a long time since it starts building dependencies. Moreover, it causes hie-wrapper to take way longer than necessary to find the project type, and thus, the ghc version to use on the project. This violates the isolation of the cradle, some work happens before loading the options for a filepath, some during it. This commit unifies the behaviour with hie-bios:

It speeds up the initial start-up of hie if users use the implicit cradle discovery mechanism. It makes the implementation a bit less hacky.

While there are behavioural changes, nothing should change for everyday users.

fendor commented 4 years ago

@jneira This change is also relevant for https://github.com/haskell/haskell-language-server/ I will port it, once tests run on HIE

jneira commented 4 years ago

Cabal unix jobs are failing due to disk space, so i think the pr is good

fendor commented 4 years ago

Small revision of the explanation, it only configures the projects. However, it crashes in hie-wrapper, if configuration fails, e.g. dependencies have conflicting version constraints. Now we can correctly catch these exceptions and display them to the user, similar to how we catch exceptions during building units.