haskell / haskell/haskell-language-server

HLS looking in wrong ghcup directory for documentation

Open
#3,858 1 comment 2 reactions 0 assignees View on GitHub
Hackathon level: easy os: windows type: bug
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

### Your environment

* Windows 11
* GHCup 0.1.19.4
* GHC 9.4.7
* cabal 3.10.1.0
* HLS 2.4.0.0
* vscode 1.83.1
* vscode-haskell 2.4.1

**Which OS do you use?**
Windows

**Which version of GHC do you use and how did you install it?**
9.4.7 from GHCup

**How is your project built (alternative: link to the project)?**
cabal

**Which LSP client (editor/plugin) do you use?**
vscode + vscode-haskell

**Which version of HLS do you use and how did you install it?**
2.4.0.0 from ghcup

**Have you configured HLS in any way (especially: a `hie.yaml` file)?**
No

### Steps to reproduce

There is a somewhat secret feature of HLS wherein on hover, it can show a link to Documentation/Source code on Hackage - but evidently only when you have local *.html documentation files for the code you're trying to view (which is itself a bit confusing, given you're taken to a webpage on Hackage anyway)

![image](https://github.com/haskell/haskell-language-server/assets/6138789/d71fbc1e-635a-4640-bcad-7f195cc819f0)

While the expectation is that such documentation would be generated under `C:\cabal\store\\\share\doc`, curiously, in my instance, despite having `documentation: True` and `ghc-options: -haddock` in my `C:\cabal\config` file, no documentation was generated for any packages; not that this necessarily mattered, because documentation for core libraries *was* generated under `C:\ghcup\ghc\9.4.7\doc\html\libraries`

To some extent, this is not a problem for HLS, because it *exclusively* seems to look for documentation under my *ghcup* installation. However, it would appear that HLS erroneously believes that ghcup documentation will exist under the path `C:\ghcup\ghc\doc`, as shown in this capture from Process Monitor

![image](https://github.com/haskell/haskell-language-server/assets/6138789/7504dd6e-d104-4497-9cab-c975e7cdcf38)

This is wrong - HLS should instead be looking under the subdirectory of the version of GHC that is in use by the project, i.e. in my case `C:\ghcup\ghc\9.4.7\doc`

If I symlink `C:\ghcup\ghc\doc` to `C:\ghcup\ghc\9.4.7\doc`, HLS is able to see the documentation and the *Documentation* and *Source* links display as expected, however symlinking to a specific GHC install defeats the purpose of using GHCup.

While for my purposes I'm mainly interested in getting on-hover-documentation going for the built in libraries, it's super hard to find any information about how to correctly configure this feature properly; there are half a dozen different issues that all seem to contain contradictory information.

### Expected behaviour

HLS should locate the *.html documentation files in the correct directory

### Actual behaviour

HLS looks in the wrong directory for *.html documentation files

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.