Skip to content

Conversation

@Saizan
Copy link

@Saizan Saizan commented Oct 25, 2025

This is enabled by the new linkToHackage configuration option.

This is useful if you don't have local documentation or sources built, or other minor downsides of using local files. The vscode-haskell provides similar functionality but by trying to mangle the local file links, which is error prone because the path structure has changed between ghc versions.

If local documentation/source exists it gets used as a hint for which module to link to, which generally gives better results in case of re-exports. Otherwise we pick the module where the name is defined, and generate the link using its package name and version.

I am quite unsure if how I wired in the linkToHackage config option is appropriate. But I didn't want to do any refactor without some feedback first.

Initially I figured linkToHackage should be a plugin config for ghcide-hover-and-symbols, but the flag affects the GetDocMap rule which structurally appears to be more part of the core? The first way I wrote it I got import cycles so I backed off.

I am happy to have the flag where it is or move it if desired. And in any case I will split it into linkDocToHackage and linkSrcToHackage for flexibility.

controlled by `linkToHackage` configuration field
Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One suggestion and can we add a regression test case, somehow to make sure this doesn't accidentally break?

Otherwise, LGTM :)

Comment on lines +88 to +89
, optLinkToHackage :: Bool
-- ^ `Documentation` and `Source` link to Hackage, rather than local docs.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a type OptLinkToHackage to avoid some boolean blindness, what do you think about that?

@fendor fendor added the status: needs review This PR is ready for review label Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs review This PR is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants