-
-
Notifications
You must be signed in to change notification settings - Fork 389
Add custom cache layer for session loading #1197
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
Conversation
Do we have some test around |
Wouldn't it be simpler to make hie-bios detect and return the correct cradle location for files in |
@wz1000 The invoked function is Also, I think this is rather a HLS bug than hie-bios' bug, since hie-bios lists all modules and options (including Paths_* module), HLS should be able to work with it. Thus, the patch here. Another possible implementation approach might be to utilise the Shake graph in some way. |
We can write the path to the original hie.yaml file/root in something like I'm also concerned about the behavior with other kinds of preprocessed haskell files, like happy parsers, hsc files etc. I think even they will end up being written in the builddir. |
Seems kind of hacky to me, when HLS should have all the required information already (e.g. |
I marked it as draft in github following the description, to no merge it accidentally |
I'm not too worried by the increase in memory usage, did you check the benchmarks? |
I think that we should push ahead with this, unless there is a better solution available. Waiting for Cabal is just mad |
I will check the benchmarks and address the feedback, thank you! |
31f7e60
to
8e22ad4
Compare
8e22ad4
to
91f4550
Compare
Achieves this by adding a HashMap from NormalizedFilePath to its respective hie.yaml location. This works nicely with the existing implementation, but increases the memory usage by an considerable amount. This change is motivated by haskell/hie-bios#264 where we set the build-dir for cabal based projects to some config directory in order to avoid recompilation issues whenever users invoked `cabal build`. However, this uncovered an issue in the existing code-base, as HLS will ask for the compilation options for generated modules, such as `Paths_*`, by looking for the responsible `hie.yaml` file and using an internal cache for the options. This used to be fine, until the aforementioned hie-bios change, since now `Paths_*` module will be in some `~/.cache/hie-bios/...` directory, which has no responsible `hie.yaml` which is why we see error messages such: `No hie.yaml found, use implicit hie-bios`.
91f4550
to
d7a4591
Compare
Those are just artifacts. The graphs are identical for all purposes. |
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.
I think this is ready to merge
modifyVar with evaluate
I will make a release for hie-bios with the mentioned change, and we will see if there is any fallout :) |
@fendor I think haskell/hie-bios#265 is also important in order to actually make ghcide startup faster. |
@wz1000 True, but it already improves the developer flow by not forcing the user to re-configure whenever they use cabal. |
Achieves this by adding a HashMap from NormalizedFilePath
to its respective
hie.yaml
location.This works nicely with the existing implementation, but
increases the memory usage (and I am not sure whether by a considerable amount).
This change is motivated by haskell/hie-bios#264
where we set the build-dir for cabal based projects to some config
directory in order to avoid recompilation issues whenever users invoked
cabal build
.However, this uncovered an issue in the existing code-base, as HLS will
ask for the compilation options for generated modules, such as
Paths_*
, by looking for the responsiblehie.yaml
file and using aninternal cache for the options. This used to be fine, until the
aforementioned hie-bios change, since now
Paths_*
module will be insome
~/.cache/hie-bios/...
directory, which has no responsiblehie.yaml
which is why we see error messages such:No hie.yaml found, use implicit hie-bios
.I think this error message was only shown when an explicit
hie.yaml
is used.I hope the motivation and explanation was understandable :) (and sound, and correct)
The implementation is more a POC, to show that it really fixes the problem.
You can give it a try and see the changes by checking out https://github.com/fendor/haskell-language-server/tree/cabal-dist-dir-tests and using it on
exe:hie-bios
. Compare it to the output HLS gives when reverting the last commit to that branch.cc @wz1000