haskell / haskell/haskell-language-server

Correct way to build a project in order to have Haddocks displayed on hover

Open
#4,210 9 comments 6 reactions 0 assignees View on GitHub
documentation type: support
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
3d 21h
Merged PRs (30d)
13

Description

## Your environment

haskell-language-server version: 2.7.0.0
editor: neovim

## What's wrong?

It appears that the haddocks of an identifier are unreliably shown.

For a local identifier, no problem

![Screenshot_20240505_150822](https://github.com/haskell/haskell-language-server/assets/29253044/21addf4e-c445-4906-8f7d-e78fc04c6f12)

But for dependencies it's not a granted.

![Screenshot_20240505_150856](https://github.com/haskell/haskell-language-server/assets/29253044/fce0a802-66fc-4aa9-a149-a997616b2f09)

I have a `cabal.project` file with the following:

```cabal
packages: ./
with-compiler: ghc-9.4
documentation: True

package *
documentation: True
```

What am I missing? I thought I had covered all the cases?

### Debug information

Build log:

```bash

Build profile: -w ghc-9.4.8 -O1
In order, the following will be built (use -v for more details):
- os-string-2.0.2 (lib) (requires build)
- hashable-1.4.4.0 (lib) (requires build)
- unordered-containers-0.2.20 (lib) (requires build)
- relude-1.2.1.0 (lib) (requires build)
- cabaltest-0.1.0.0 (lib) (dependency rebuilt)
- cabaltest-0.1.0.0 (exe:cabaltest) (dependency rebuilt)
Starting os-string-2.0.2 (lib)
Building os-string-2.0.2 (lib)
Haddock os-string-2.0.2 (lib)
Installing os-string-2.0.2 (lib)
Completed os-string-2.0.2 (lib)
Starting hashable-1.4.4.0 (lib)
Building hashable-1.4.4.0 (lib)
Haddock hashable-1.4.4.0 (lib)
Installing hashable-1.4.4.0 (lib)
Completed hashable-1.4.4.0 (lib)
Starting unordered-containers-0.2.20 (lib)
Building unordered-containers-0.2.20 (lib)
Haddock unordered-containers-0.2.20 (lib)
Installing unordered-containers-0.2.20 (lib)
Completed unordered-containers-0.2.20 (lib)
Starting relude-1.2.1.0 (lib)
Building relude-1.2.1.0 (lib)
Haddock relude-1.2.1.0 (lib)
Installing relude-1.2.1.0 (lib)
Completed relude-1.2.1.0 (lib)
Preprocessing library for cabaltest-0.1.0.0..
Building library for cabaltest-0.1.0.0..
Preprocessing library for cabaltest-0.1.0.0..
Running Haddock on library for cabaltest-0.1.0.0..
50% ( 1 / 2) in 'MyLib'
Missing documentation for:
Module header

src/MyLib.hs:14:1: warning: [-Wunused-top-binds]
Defined but not used: ‘test’
|
14 | test = someFunc
| ^^^^
Documentation created:
/home/hecate/Téléchargements/test/cabal-test/dist-newstyle/build/x86_64-linux/ghc-9.4.8/cabaltest-0.1.0.0/doc/html/cabaltest/
Preprocessing executable 'cabaltest' for cabaltest-0.1.0.0..
Building executable 'cabaltest' for cabaltest-0.1.0.0..
[2 of 2] Linking /home/hecate/Téléchargements/test/cabal-test/dist-newstyle/build/x86_64-linux/ghc-9.4.8/cabaltest-0.1.0.0/x/cabaltest/build/cabaltest/cabaltest [Library changed]
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the hover behavior in Neovim using the reported haskell-language-server version and the shown cabal.project settings. Compare local identifiers with dependency identifiers, using the build log to confirm Haddock generation. Done means dependency Haddock documentation appears reliably on hover, with the required build configuration or failure condition documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell, neovim
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.