Skip to content

With Ormolu as the formatting provider, need BangPatterns (el al.) without putting it in every file #382

Closed
@complyue

Description

@complyue

Subject of the issue

With Ormolu as the formatting provider, need BangPatterns (el al.) without putting it in every file

Language extensions (those not enabled by Ormolu automatically), if not put in every source file, can only be specified on the command line of ormolu according to tweag/ormolu#650

Until it can obtain enabled extension list from the project's .cabal file, we need a way to customize Ormolu's command line to tell such extensions, when not willing to put them into every source file.

Your environment

  • Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools
$ haskell-language-server-wrapper --probe-tools
haskell-language-server version: 0.4.0.0 (GHC: 8.8.3) (PATH: /Users/cyue/.local/bin/haskell-language-server-wrapper) (GIT hash: 1d1ab3bad0d6d0528b8cdeaa697836b18508b596)
Tool versions found on the $PATH
cabal:		3.2.0.0
stack:		2.3.3
ghc:		8.8.3
  • Which lsp-client do you use

    • VSCode
  • Describe your project (alternative: link to the project)

https://github.com/e-wrks/edh

  • Contents of hie.yaml

    No this file

Steps to reproduce

Make sure Ormolu is selected as the "Formatting Provider"
Format some file uses BangPatterns syntax but doesn't contain a pragma for it.

Expected behaviour

File content formatted.

Actual behaviour

File content not formatted.

Include debug information

[Error - 7:57:08 PM] Request textDocument/formatting failed.
  Message: ormoluCmd: OrmoluParsingFailed (RealSrcSpan SrcSpanOneLine /some/where/xxx.hs" 48 20 24) "Illegal bang-pattern (use BangPatterns):\n! cap"
  Code: -32602 

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: pluginstype: 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