haskell / haskell/haskell-language-server

Calling Fourmolu via HLS infers wrong fixities

Open
#3,421 1 comment 0 reactions 1 assignee Claimed by @georgefst View on GitHub
type: bug
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
3d 21h
Merged PRs (30d)
13

Description

When using Fourmolu as a formatter via HLS, it infers different fixities of binary operators than when calling Fourmolu directly via the command line. This happens regardless of whether HLS uses its built-in Fourmolu or calls an external one.

It happened with the following operators:
- `^.` from [`lens`](https://hackage.haskell.org/package/lens-5.2/docs/Control-Lens-Getter.html#v:-94-.)
- `##` from [`map-syntax`](https://hackage.haskell.org/package/map-syntax-0.3/docs/Data-Map-Syntax.html#v:-35--35-)
- `.:` from [`digestive-functors`](https://hackage.haskell.org/package/digestive-functors-0.8.4.2/docs/Text-Digestive-Form.html#v:.:)

It is relatively easy to circumvent by specifying these fixities explicitly in `fourmolu.yaml`, but it is still a little annoying. It also took me a while to figure out why it was behaving differently.

### Your environment

Which OS do you use?
openSUSE
Which LSP client (editor/plugin) do you use?
VS Code & Haskell extension
Which version of HLS do you use and how did you install it?
1.8.0.0 via ghcup via VS Code Haskell extension
Have you configured HLS in any way (especially: a `hie.yaml` file)?
Only via VS Code

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.