Open jhrcek opened 2 years ago
This seems to be problem in vscode-haskell, which is replacing -
s with .
s here:
https://github.com/haskell/vscode-haskell/blob/7eb6a485e1e443c2eea195f0afe37e6b9963c22c/src/docsBrowser.ts#L160-L163
The logic replacing -s with .s was introduced in this PR: https://github.com/haskell/vscode-haskell/pull/452
Yeah, thanks for the report and the further investigation, moving to the extension repo
For reference here's a related upstream issue in haddock : https://github.com/haskell/haddock/issues/1447 My understanding of why the source links are broken: some time ago there was a change in haddock in how the html files with hyperlinked source are named.
In more recent versions of haddock, the hyperlinked source code files contain -
as module separator(e.g. Control-Monad.html), in older version of haddock they contain .
as module separator (Control.Monad.html). The code linked above always assumes .
is used as module name separator which is where you get "Page Not Found" error when you click on Source link in vscode, but if you fix the URL manually by replacing . with - you'll see the hyperlinked source code.
I'm not sure what's the best way to fix this - someone COULD go and fix the haddock logic upstream so it always uses '.' as separator. But then you'd still have tons of haddocks generated on hackage which still use '-' as separator, for which the link would still be broken.
Another option would be to fix the typescript logic in vscode-haskell - but since it doesn't know what version of haddock was used to generate the docs, it doesn't know whether it should use '-' or '.'. Not sure how this could be improved :(
Thanks for the investigation here @jhrcek. My recommendation would be the extension should either:
Prefer the most recent format. Sounds like the -
, this is because HLS and thereby the extension really only work with the 3 most recent GHC versions and will continue to leave older GHC/Stackage LTS/etc behind. It would certainly be better I think to continue supporting the latest especially since it doesn't sound like it will be reverted.
Another option would be to support both, and add a config parameter to the extension so people can tweak it to their needs. Seems like a good bit more work without a clear benefit
Might be worthwhile instead grabbing the URLs that HLS already produces: https://github.com/haskell/haskell-language-server/issues/3475#issuecomment-2134020222
Your environment
Which OS do you use: Linux, fedora 34
Which lsp-client do you use: Vscode Describe your project (alternative: link to the project): stack based project
Steps to reproduce
See steps gif:
Expected behaviour
Correct page is opened on hackage https://hackage.haskell.org/package/base-4.14.3.0/docs/src/Data-Foldable.html#concatMap
Actual behaviour
Invalid URL is opened on hackage https://hackage.haskell.org/package/base-4.14.3.0/docs/src/Data.Foldable.html#concatMap ` ^ It should be Data-Foldable, not Data.Foldable
Include debug information
Execute in the root of your project the command
haskell-language-server-wrapper --debug .
and paste the logs here: (if you are using the vscode extension check the executable location here)Debug output:
```Paste the logs from the lsp-client, you can check instructions about for VS Code here
LSP logs:
```