-
-
Notifications
You must be signed in to change notification settings - Fork 369
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
Customize the unitId used for the fake internal component #1435
Conversation
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.
LGTM.
I think "main" fake_uid
can work, at least I don't know of a blocker from the top of my head.
Perfect, let's change it and see what the test suite says |
f9ca4ca
to
76ea473
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.
Can we set the unit id per component? hiedb expects a unique (ModuleName
, UnitId
) pair which causes some issues with main modules: wz1000/HieDb#13
I remember the unit id was set to the same for each component for a reason. However, writing a test for it and proving that it does or doesn't work is probably the best course of action. |
I think the answer is no, see: haskell-language-server/ghcide/session-loader/Development/IDE/Session.hs Lines 714 to 717 in 76ea473
|
OK. However, this change will mean that the hiedb database will have a lot of duplicate/redundant keys which will show up in queries. I think we will need to write a migration script for this - the easiest thing to do would be to just delete all the modules from "fake_uid", and letting ghcide take care of re-indexing. Another easy change could be to just bump See https://github.com/wz1000/HieDb/blob/62e24fb2b10ed17fadb0b1c69fc1067b6fc2984e/src/HieDb/Create.hs#L264 and https://github.com/wz1000/HieDb/blob/62e24fb2b10ed17fadb0b1c69fc1067b6fc2984e/src/HieDb/Create.hs#L38 respectively. |
How about adding a version number to the path computed by |
5aa2569
to
5aabcac
Compare
@wz1000 I have added the version number to the hiedb path |
ghcide sets a custom unit id for the internal component. While this is mostly an internal implementation detail, it leaks out when trying to reuse interface files produced by ghc, which will need to be configured with
--this-unit-id fake_uid
. This is fine, but what if in the future ghcide changes the fake uid string?This PR adds a flag to control the fake uid string which can be used to get some protection against future ghcide changes.
Additionally, we should probably change the default value to "main", which is the name ghc uses for the default component, in order to make the scenario above, reusing interface files produced by ghc, work out of the box in most cases. Thoughts @fendor @wz1000 ?