Skip to content

Commit 1d2d7d2

Browse files
committed
Add log message for missing cabal-fmt executable
1 parent 8c1eeae commit 1d2d7d2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: plugins/hls-cabal-fmt-plugin/src/Ide/Plugin/CabalFmt.hs

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ data Log
2121
= LogProcessInvocationFailure Int
2222
| LogReadCreateProcessInfo String [String]
2323
| LogInvalidInvocationInfo
24+
| LogCabalFmtNotFound
2425
deriving (Show)
2526

2627
instance Pretty Log where
@@ -31,6 +32,7 @@ instance Pretty Log where
3132
["Invocation of cabal-fmt with arguments" <+> pretty args]
3233
++ ["failed with standard error:" <+> pretty stdErrorOut | not (null stdErrorOut)]
3334
LogInvalidInvocationInfo -> "Invocation of cabal-fmt with range was called but is not supported."
35+
LogCabalFmtNotFound -> "Couldn't find executable 'cabal-fmt'"
3436

3537
descriptor :: Recorder (WithPriority Log) -> PluginId -> PluginDescriptor IdeState
3638
descriptor recorder plId =
@@ -66,6 +68,7 @@ provider recorder _ide FormatText contents nfp opts = liftIO $ do
6668
let fmtDiff = makeDiffTextEdit contents (T.pack out)
6769
pure $ Right fmtDiff
6870
Nothing -> do
71+
log Error LogCabalFmtNotFound
6972
pure $ Left (ResponseError InvalidRequest "No installation of cabal-fmt could be found. Please install it into your global environment." Nothing)
7073
where
7174
fp = fromNormalizedFilePath nfp

0 commit comments

Comments
 (0)