Skip to content

Ormolu/Fourmolu incorrectly infers GHC2021 in Stack projects #3439

Open
@keithfancher

Description

@keithfancher

Summary: Formatting via HLS moves my qualified keywords as if I had the ImportQualifiedPost plugin enabled, which I do not. Interestingly, this bug only seems to occur in projects using GHC 9.2.5?

Note that I've tried the standalone ormolu (0.5.1) and this problem does not occur. I can't figure out how to check which version of ormolu my HLS is using, however...

Your environment

Which OS do you use?

Ubuntu 20.04

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

9.2.5, installed via stack.

NOTE: I tried this in an older project, using GHC 9.0.2 (also via stack), and the bug did NOT occur.

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

stack

Which LSP client (editor/plugin) do you use?

Tried in neovim 0.8.2 and vs code 1.74.2 with same result.

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

HLS 1.9.0, via ghcup.

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

No extra configs

Steps to reproduce

  1. Verify that ImportQualifiedPost is not enabled anywhere in the project
  2. Add a qualified import
  3. Use HLS to format the file

Expected behaviour

The following import should remain as-is:

import qualified Data.Text as T

Actual behaviour

The import is altered, qualified is moved:

import Data.Text qualified as T

Debug information

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions