-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Rewrite Documentation/Source links on hover to use local hoogle/hackage if available on nix and otherwise #3475
Comments
Would also like this due to having some dependencies that aren't present in hackage at all. |
I was thinking a little bit about this, and what would the haddock root look like? Given the example above, providing a root location is easy, but nix stores the documentation in |
Hmm true, we'd need to be able to override on a per-package basis. Which makes some sense I guess, you could have most packages coming from hackage but a few hosted on an org-specific repository? So the flag would need to be a filepath to a file with contents similar to
|
After some more thought, I realised HLS probably should be getting the urls from
For the specific case of nix-built dependencies, this seems to solve the entire problem as every dep ends up in the package database. Following the above source directions by @ParetoOptimalDev, I ended up very surprised seeing HLS is already doing this: haskell-language-server/ghcide/src/Development/IDE/Spans/Documentation.hs Lines 157 to 161 in 838a51f
However, vscode-haskell hardcodes to hackage. On the other hand, haskell-mode seems to produce the right links - not sure whether it's getting them from HLS or something else. I only use emacs/vscode so don't know the status on extensions for other editors. |
Is your enhancement request related to a problem? Please describe.
This request is similar to #208, but slightly different? At least the fact that this issue is focused on nix support makes it different, but the implementation of this could satisfy both issues I believe.
Even when I have a local instance of hoogle running at
localhost:8888
the links I click for source and documentation go tohttp://haskell.org
.NOTE: I use nix's
withHaddock
feature for thisFor instance I'm linked to:
https://hackage.haskell.org/package/apecs-0.9.4/docs/Apecs-Util.html#v:newEntity_
When I'd prefer to be linked to:
http://localhost:8888/file/nix/store/pmyb1ayz7vxlmim1bd12sjpss3s7pddy-apecs-0.9.4-doc/share/doc/apecs-0.9.4/html/Apecs.html#v:newEntity_
Describe the solution you'd like
For HLS to check to see if a hoogle instance is running and if it's fingerprint is a nix server, rewrite urls like:
And for source:
Looking at the above, the common replacement within the urls is:
You can get this variable in recent versions of Nix's
haskellPackages
from the environmental variable$NIX_GHC_DOCDIR
.NOTE: I believe the code to change is in Development.IDE.Spans.Documentation.getDocumentationsTryGhc
Describe alternatives you've considered
A workaround described here:
To be frank though, I'd just never do that and probably forget it was ever an option.
The text was updated successfully, but these errors were encountered: