Skip to content

Improve missing brittany format provider error message (#269) #414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion hls-plugin-api/src/Ide/Plugin/Formatter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,19 @@ doFormatting lf providers ideState ft uri params = do
provider lf ideState ft contents fp params
Nothing -> return $ Left $ responseError $ T.pack $ "Formatter plugin: could not get file contents for " ++ show uri
Nothing -> return $ Left $ responseError $ T.pack $ "Formatter plugin: uriToFilePath failed for: " ++ show uri
Nothing -> return $ Left $ responseError $ T.pack $ "Formatter plugin: no formatter found for:[" ++ T.unpack mf ++ "]"
Nothing -> return $ Left $ responseError $ mconcat
[ "Formatter plugin: no formatter found for:["
, mf
, "]"
, if mf == "brittany"
then T.unlines
[ "\nThe haskell-language-server must be compiled with the agpl flag to provide Brittany."
, "Stack users add 'agpl: true' in the flags section of the 'stack.yaml' file."
, "The 'haskell-language-server.cabal' file already has this flag enabled by default."
, "For more information see: https://github.com/haskell/haskell-language-server/issues/269"
]
else ""
]

-- ---------------------------------------------------------------------

Expand Down