vscode-haskell icon indicating copy to clipboard operation
vscode-haskell copied to clipboard

Documentation/Source links to wrong URI when opened in Hackage (with ghc >= 9.8.4).

Open Saizan opened this issue 5 months ago • 1 comments

This is the same problem as https://github.com/haskell/haskell-language-server/issues/4579. I believe the "bug" is in the vscode extension so I opened this. Also, I can reproduce on linux with recent enough ghc versions, i.e starting with ghc-9.8.4.

The crux is that HLS is sending the URIs for the locally stored docs, e.g.

[Documentation](file:///home/vscode/.ghcup/ghc/9.8.4/share/doc/ghc-9.8.4/html/libraries/base-4.19.2.0-9fbd/System-IO.html#v:putStrLn)

[Source](file:///home/vscode/.ghcup/ghc/9.8.4/share/doc/ghc-9.8.4/html/libraries/base-4.19.2.0-9fbd/src/System.IO.html#putStrLn)

and vscode-haskell does some mangling to point them to Hackage instead. Since ghc-9.8.4 the mangling is insufficient, as it keeps the -9fbd suffix in the URI, which is not correct.

The package directories are named $pkg_name-$pkg_ver-$hex where $hex is 4 hex digits. We want to drop the -$hex suffix, and since $pkg_ver cannot contain - it's actually unambiguous.

Saizan avatar Sep 11 '25 09:09 Saizan

Actually the hex can be a whole hash apparently, but same reasoning applies

[Documentation](file:///home/user/.local/state/cabal/store/ghc-9.12.2-9b33/aeson-2.2.3.0-bad24797c156fdef032726b6d06de9b8f2b16759664bc57e515ef352d0796710/share/doc/html/Data-Aeson-Types.html#t:Value)

although in my case vscode-haskell mangling turned that into https://hackage.haskell.org/package/html-1.0.1.2/docs/Data-Aeson-Types.html#t:Value so I suppose there's more problems. The directory structure in the store does seem pretty different.

Saizan avatar Sep 11 '25 10:09 Saizan