@@ -41,41 +41,40 @@ provider ideState typ contents fp fo = withIndefiniteProgress title Cancellable
41
41
fileOpts <- case hsc_dflags . hscEnv <$> ghc of
42
42
Nothing -> return []
43
43
Just df -> liftIO $ convertDynFlags df
44
-
45
- let format printerOpts =
46
- first (mkError . show )
47
- <$> try @ OrmoluException (makeDiffTextEdit contents <$> ormolu config fp' (T. unpack contents))
48
- where
49
- config =
50
- defaultConfig
51
- { cfgDynOptions = map DynOption fileOpts
52
- , cfgRegion = region
53
- , cfgDebug = True
54
- , cfgPrinterOpts =
55
- fillMissingPrinterOpts
56
- (printerOpts <> lspPrinterOpts)
57
- defaultPrinterOpts
58
- }
59
-
60
- liftIO (loadConfigFile fp') >>= \ case
61
- ConfigLoaded file opts -> liftIO $ do
62
- putStrLn $ " Loaded Fourmolu config from: " <> file
63
- format opts
64
- ConfigNotFound searchDirs -> liftIO $ do
65
- putStrLn
66
- . unlines
67
- $ (" No " ++ show configFileName ++ " found in any of:" ) :
68
- map (" " ++ ) searchDirs
69
- format mempty
70
- ConfigParseError f (_, err) -> do
71
- sendNotification SWindowShowMessage $
72
- ShowMessageParams
73
- { _xtype = MtError
74
- , _message = errorMessage
75
- }
76
- return . Left $ responseError errorMessage
77
- where
78
- errorMessage = " Failed to load " <> T. pack f <> " : " <> T. pack err
44
+ do
45
+ let format printerOpts =
46
+ first (mkError . show )
47
+ <$> try @ OrmoluException (makeDiffTextEdit contents <$> ormolu config fp' (T. unpack contents))
48
+ where
49
+ config =
50
+ defaultConfig
51
+ { cfgDynOptions = map DynOption fileOpts
52
+ , cfgRegion = region
53
+ , cfgDebug = True
54
+ , cfgPrinterOpts =
55
+ fillMissingPrinterOpts
56
+ (printerOpts <> lspPrinterOpts)
57
+ defaultPrinterOpts
58
+ }
59
+ in liftIO (loadConfigFile fp') >>= \ case
60
+ ConfigLoaded file opts -> liftIO $ do
61
+ putStrLn $ " Loaded Fourmolu config from: " <> file
62
+ format opts
63
+ ConfigNotFound searchDirs -> liftIO $ do
64
+ putStrLn
65
+ . unlines
66
+ $ (" No " ++ show configFileName ++ " found in any of:" ) :
67
+ map (" " ++ ) searchDirs
68
+ format mempty
69
+ ConfigParseError f (_, err) -> do
70
+ sendNotification SWindowShowMessage $
71
+ ShowMessageParams
72
+ { _xtype = MtError
73
+ , _message = errorMessage
74
+ }
75
+ return . Left $ responseError errorMessage
76
+ where
77
+ errorMessage = " Failed to load " <> T. pack f <> " : " <> T. pack err
79
78
where
80
79
fp' = fromNormalizedFilePath fp
81
80
title = " Formatting " <> T. pack (takeFileName fp')
0 commit comments