Skip to content

Failed to format code with error "OrmoluParsingFailed" #3912

@yttriumz

Description

@yttriumz

Your environment

Which OS do you use?

Operating System: openSUSE Tumbleweed 20231206
KDE Plasma Version: 5.27.9
KDE Frameworks Version: 5.112.0
Qt Version: 5.15.11
Kernel Version: 6.6.3-1-default (64-bit)
Graphics Platform: X11

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

Output of haskell-language-server-wrapper --probe-tools:

haskell-language-server version: 2.4.0.0 (GHC: 9.0.2) (PATH: /home/az/.ghcup/hls/2.4.0.0/lib/haskell-language-server-2.4.0.0/bin/haskell-language-server-wrapper)
Tool versions found on the $PATH
cabal:          3.6.2.1
stack:          2.11.1
ghc:            9.4.7

Tool versions in your project
2023-12-18T06:37:13.171524Z | Debug | executing command: ghc --numeric-version
ghc:            9.4.7

Installed via curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

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

https://github.com/Alecton4/playground-Haskell/blob/master/Stdm.lhs

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

VSCode 1.85.0 + haskell.haskell 2.4.2

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

See above.

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

No.

Steps to reproduce

  1. Open the file and try to format it.

Expected behaviour

The file should be formatted, I guess.

Actual behaviour

An error occur:

image

Debug information

The log in the output panel:

2023-12-18T06:39:31.407264Z | Error | ormolu: Internal Error: ormoluCmd: OrmoluParsingFailed (RealSrcSpan SrcSpanOneLine "/home/az/workspace/playground-Haskell/playground/Stdm.lhs" 6 1 5 Nothing) "[GHC-58481] parse error on input `Last'"
[Error - 2:39:31 PM] Request textDocument/formatting failed.
  Message: ormolu: Internal Error: ormoluCmd: OrmoluParsingFailed (RealSrcSpan SrcSpanOneLine "/home/az/workspace/playground-Haskell/playground/Stdm.lhs" 6 1 5 Nothing) "[GHC-58481] parse error on input `Last'"
  Code: -32603 

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