Skip to content

Commit a084830

Browse files
Break out format call
1 parent 88990ba commit a084830

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

plugins/hls-fourmolu-plugin/src/Ide/Plugin/Fourmolu.hs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,14 @@ provider recorder plId ideState typ contents fp fo = ExceptT $ withIndefinitePro
9090
, cfgDebug = False
9191
, cfgPrinterOpts = resolvePrinterOpts [lspPrinterOpts, printerOpts]
9292
}
93-
in liftIO (loadConfigFile fp') >>= \case
93+
cfg <-
94+
liftIO (loadConfigFile fp') >>= \case
9495
ConfigLoaded file opts -> do
9596
logWith recorder Info $ ConfigPath file
96-
mapExceptT liftIO $ format opts
97+
pure opts
9798
ConfigNotFound searchDirs -> do
9899
logWith recorder Info $ NoConfigPath searchDirs
99-
mapExceptT liftIO $ format emptyConfig
100+
pure emptyConfig
100101
ConfigParseError f err -> do
101102
lift $ sendNotification SMethod_WindowShowMessage $
102103
ShowMessageParams
@@ -106,6 +107,8 @@ provider recorder plId ideState typ contents fp fo = ExceptT $ withIndefinitePro
106107
throwError $ PluginInternalError errorMessage
107108
where
108109
errorMessage = "Failed to load " <> T.pack f <> ": " <> T.pack (show err)
110+
111+
mapExceptT liftIO $ format cfg
109112
where
110113
fp' = fromNormalizedFilePath fp
111114
title = "Formatting " <> T.pack (takeFileName fp')

0 commit comments

Comments
 (0)