Use Hackage for Documentation and Source links#4746
Conversation
fendor
left a comment
There was a problem hiding this comment.
One suggestion and can we add a regression test case, somehow to make sure this doesn't accidentally break?
Otherwise, LGTM :)
3f5aa28 to
4977a57
Compare
|
@fendor I got a bit lost trying to add regression tests, would it look something like the ones in FindDefinitionAndHoverTests ? |
|
@Saizan Overall looks good, what you linked is a good pattern to follow, but from what i could see, |
cf02192 to
f97238e
Compare
fendor
left a comment
There was a problem hiding this comment.
LGTM, thank you!
I am wondering what the default should be and we need to add it as a vscode config as well, so the users can change it...
Should the default be LinkToHackage or do you prefer LinkToSource?
|
I have been using LinkToHackage because I often don't have the local versions, however I figured we'd leave the old behavior as default |
vidit-od
left a comment
There was a problem hiding this comment.
Looks good to me as well !! LGTM !!
also, LinktoSource seems like a good default to me.
In VSCode, this links to an HTML page which is not rendered, so I don't think that's a good default. Screencast_20260515_111823.webm
In VSCode, we rewrote this to hackage links, so it is not really the "default". Thus, I request to change the default to |
|
It is properly rendered for me, but the links within it are opened in my actual browser, where they do not not resolve properly. I'll make LinkToHackage the default for both documentation and source then. |
b2a9ddc to
c267b95
Compare
controlled by `linkDocTo` and `linkSourceTo` configuration fields
This is enabled by the new
linkToHackageconfiguration option.This is useful if you don't have local documentation or sources built, or other minor downsides of using local files. The
vscode-haskellprovides 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
linkToHackageconfig option is appropriate. But I didn't want to do any refactor without some feedback first.Initially I figured
linkToHackageshould be a plugin config forghcide-hover-and-symbols, but the flag affects theGetDocMaprule 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.