Haskell-language-server: Improve error message when Brittany is selected as a formatter and server is built without -fagpl

Created on 2 Aug 2020  路  3Comments  路  Source: haskell/haskell-language-server

I try to replace Ormolu by Brittany, but I get this message: Formatter plugin: no formatter found for:[brittany]. I'm using Neovim + Coc, here my config:

  "languageserver": {
    "haskell": {
      "command": "haskell-language-server-wrapper",
      "args": ["--lsp"],
      "filetypes": [
        "hs",
        "lhs",
        "haskell"
      ],
      "rootPatterns": [
        "*.cabal",
        "stack.yaml",
        "cabal.project",
        "package.yaml"
      ],
      "initializationOptions": {
        "haskell": {
          "formattingProvider": "brittany"
        }
      }
    },

I tried to installed brittany globally and locally (inside my project), but I still get the same error. I'm using ghc v8.8.4 with stack v2.3.1.

It could be interesting to add a tiny section about how to use a different formatting provider.

install good first issue

Most helpful comment

Ah, for the Brittany formatter you need to build Haskell-language-server from source with the -fagpl cabal flag. You shouldn't need to add Brittany as a dependency to your project! The binaries are built without this for licensing reasons, but indeed the error message should be better about this. I'll convert this into a todo

All 3 comments

Ah, for the Brittany formatter you need to build Haskell-language-server from source with the -fagpl cabal flag. You shouldn't need to add Brittany as a dependency to your project! The binaries are built without this for licensing reasons, but indeed the error message should be better about this. I'll convert this into a todo

Indeed, works like a charm after adding agpl: true in the flags section of the stack.yaml and compiling with stack ./install.hs hls-8.8.4. Thank you!

I think this issue can be closed now.

Was this page helpful?
0 / 5 - 0 ratings