haskell / haskell/haskell-language-server

Improving Handling of Structured Diagnostics

Open
#4,735 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

Most of HLS is now using GHC structured diagnostics instead of regexes (#4605). However, there are still some messages we still rely on regex matching for, because they aren't available in structured format. I've created a [GHC issue](https://gitlab.haskell.org/ghc/ghc/-/issues/26353), but I'm not sure if this is a complete list.

## Known Instances

Here are the ones I know about:

**[Suggest Type Signature Change](https://github.com/haskell/haskell-language-server/blob/master/plugins/hls-change-type-signature-plugin/src/Ide/Plugin/ChangeTypeSignature.hs#L154)**: We have to extract the declName from a type mismatch from the `ErrInfo` (an `SDoc`).

**[Fill typed holes](https://github.com/haskell/haskell-language-server/pull/4695/files#diff-68eeecbcd90f79a3382f0c7c6bbdebd5e7495d52d821bc3c491742364009e125R108)**: The hole fit and refinement suggestions are stored in `ErrInfo` supplementary.

**[Fill type wildcard](https://github.com/haskell/haskell-language-server/blob/master/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/FillTypeWildcard.hs#L104)**: We need to determine whether the user wrote a top-level hole, for example whether the user wrote `foo :: _` or `foo :: Maybe _`. We do this again, by looking at `ErrInfo` context.

## Discussion

To move forward, we'll still need to

* Make sure the list above is complete
* Figure out specifically which fields we need to add

## Related Links

https://github.com/haskell/haskell-language-server/issues/4605
https://gitlab.haskell.org/ghc/ghc/-/issues/26353

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.