Skip to content
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

Show versions of installed packages #4430

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

lucalabs-de
Copy link

Implements #4416. Shows installed versions of cabal dependencies as inlay hints, or alternatively as code lenses when inlay hints are not supported.

2024-10-14-152038_1271x1059_scrot

Code Lenses are currently always displayed at the beginning of the line, I'm not sure if this is an error on my part or a VSCode thing. Depending on how the cabal file is formatted, this can look unpleasant:

2024-10-14-152248_867x341_scrot

I don't yet show the version information in the hover overlay as mentioned in the issue, since I was not sure how it should interplay with #4417. However, it should be a quick change to show it there as well.

@lucalabs-de lucalabs-de requested a review from fendor as a code owner October 14, 2024 11:32
@lucalabs-de lucalabs-de changed the title Show version of installed packages Show versions of installed packages Oct 14, 2024
@fendor
Copy link
Collaborator

fendor commented Oct 20, 2024

Discussing the feature with @wz1000, HLS knows the exact package versions as it intercepts the cabal build requests containing the ghc-options -package-id base-4... -package-id aeson-2.2....

That means, given the HscEnv a particular .cabal version belongs to, we should be able to consult the UnitState and UnitInfoMap in particular to find the exact version dependencies without resorting to reading plan.json.

If you are interested in implementing this feature based on the ghc-options, I can try to write it down how I think it should work, or we can pair a little bit some time in the future?

@lucalabs-de
Copy link
Author

That certainly seems like a more sensible approach. I'm definitely interested in implementing it. You can explain it here or we can pair, whatever works best for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants