haskell / haskell/vscode-haskell

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

Open
#1,303 3 comments 1 reaction 0 assignees View on GitHub
type: bug
Dominant language
TypeScript
Stars
597
Forks
98
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Research direction

Inspect the vscode-haskell extension's URI-mangling logic for HLS documentation and source links, using the examples in this issue as the starting point. Reproduce with GHC 9.8.4 or newer and verify that Hackage links omit the trailing four-hex-digit package-directory suffix while retaining the package name and version.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell, typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.