Skip to content

Compliled-in fourmolu 1.4.0.0 in HLS 2.4.0.0 formats differently than standalone compiled fourmolu 1.4.0.0 #3882

Open
@lylek

Description

@lylek

Your environment

Which OS do you use?

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

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

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

VSCode + Haskell extension
Which version of HLS do you use and how did you install it?

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

Steps to reproduce

Create code that has an infix operator leading on a line, e.g.:

module Main where

import qualified Data.Map.Strict as M

main :: IO ()
main = do
  let foo =
        M.fromList
          $ zipWith
            (+)
            [0 .. 9]
            [10, 20 .. 30]
  pure ()

Format it via VSCode (Shift+Alt+F): It remains the same.

Format it on the command line using fourmolu path/to/Main.hs. It comes out with the $ on the end of the previous line:

main :: IO ()
main = do
  let foo =
        M.fromList $
          zipWith
            (+)
            [0 .. 9]
            [10, 20 .. 30]
  pure ()

Expected behaviour

HLS in VSCode should format it with the $ trailing after M.fromList.

Actual behaviour

HLS in VSCode formats it with the $ leading before zipWith.

Debug information

On the command line:

$ fourmolu --version
fourmolu 0.14.0.0
using ghc-lib-parser 9.6.3.20231014

In the HLS log within VSCode:

2023-11-27T17:37:51.110548Z | Debug | fourmolu: Using compiled in fourmolu-0.14.0.0

Note that it doesn't say what version of ghc-lib-parser it's using. Maybe that makes the difference? Was it compiled with ghc-lib-parser 9.6.2?

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: formattersstatus: blockedNot actionable, because blocked by upstream/GHC etc.type: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions