haskell / haskell/haskell-language-server

Missing Inferred Type in Tooltip when using Visible Type Applications

Open
#4,017 19 comments 0 reactions 0 assignees View on GitHub
Hackathon type: bug
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
3d 21h
Merged PRs (30d)
13

Description

### Your environment

Which OS do you use?
ArchLinux

Which version of GHC do you use and how did you install it?
9.6.4 from ghcup

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

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

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

Have you configured HLS in any way (especially: a `hie.yaml` file)?
```
"haskell.manageHLS": "PATH",
"haskell.plugin.importLens.codeActionsOn": false,
"haskell.plugin.class.codeActionsOn": false,
"haskell.plugin.semanticTokens.globalOn": true,
```

### Steps to reproduce

Hovering over `print` in this example:
```hs
main = (print :: Int -> IO ()) 0
```
![image](https://github.com/haskell/haskell-language-server/assets/11631652/c0d3fc8d-29b3-4f84-b44a-b9597a49f002)

Hovering over `print` in this example:
```hs
main = print @Int 0
```
![image](https://github.com/haskell/haskell-language-server/assets/11631652/2473dc66-2d8d-4bfd-9524-b49fa52c43b3)

### Expected behaviour

The inferred type for `print` is shown in the tooltip in both examples.

### Actual behaviour

The inferred type for `print` is only shown with type annotations via `::`, but not with visible type applications via `@`. The inferred type is shown correctly without any type annotations (together with a warning about defaulting the type variable to `Integer`).

### Debug information

I could not find anything relevant in the HLS output log either when typing the expression or when hovering to produce the tooltip.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the tooltip behavior in HLS with the two examples, comparing the `::` annotation and `@Int` visible type application forms. Trace the hover handling for the `print` expression and verify that the inferred type appears for both forms while preserving the existing behavior for unannotated code.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.