Skip to content

Commit 3120065

Browse files
authored
Merge pull request #414 from willbush/missing-brittany-error-message
Improve missing brittany format provider error message (#269)
2 parents 61c69fd + 8d96311 commit 3120065

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

hls-plugin-api/src/Ide/Plugin/Formatter.hs

+13-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,19 @@ doFormatting lf providers ideState ft uri params = do
6262
provider lf ideState ft contents fp params
6363
Nothing -> return $ Left $ responseError $ T.pack $ "Formatter plugin: could not get file contents for " ++ show uri
6464
Nothing -> return $ Left $ responseError $ T.pack $ "Formatter plugin: uriToFilePath failed for: " ++ show uri
65-
Nothing -> return $ Left $ responseError $ T.pack $ "Formatter plugin: no formatter found for:[" ++ T.unpack mf ++ "]"
65+
Nothing -> return $ Left $ responseError $ mconcat
66+
[ "Formatter plugin: no formatter found for:["
67+
, mf
68+
, "]"
69+
, if mf == "brittany"
70+
then T.unlines
71+
[ "\nThe haskell-language-server must be compiled with the agpl flag to provide Brittany."
72+
, "Stack users add 'agpl: true' in the flags section of the 'stack.yaml' file."
73+
, "The 'haskell-language-server.cabal' file already has this flag enabled by default."
74+
, "For more information see: https://github.com/haskell/haskell-language-server/issues/269"
75+
]
76+
else ""
77+
]
6678

6779
-- ---------------------------------------------------------------------
6880

0 commit comments

Comments
 (0)