File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
plugins/hls-fourmolu-plugin/src/Ide/Plugin Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -43,12 +43,12 @@ provider ideState typ contents fp fo = withIndefiniteProgress title Cancellable
43
43
Just df -> liftIO $ convertDynFlags df
44
44
45
45
let format printerOpts =
46
- first (responseError . ( " Fourmolu: " <> ) . T. pack . show )
46
+ first (mkError . show )
47
47
<$> try @ OrmoluException (makeDiffTextEdit contents <$> ormolu config fp' (T. unpack contents))
48
48
where
49
49
config =
50
50
defaultConfig
51
- { cfgDynOptions = fileOpts
51
+ { cfgDynOptions = map DynOption fileOpts
52
52
, cfgRegion = region
53
53
, cfgDebug = True
54
54
, cfgPrinterOpts =
@@ -79,14 +79,15 @@ provider ideState typ contents fp fo = withIndefiniteProgress title Cancellable
79
79
where
80
80
fp' = fromNormalizedFilePath fp
81
81
title = " Formatting " <> T. pack (takeFileName fp')
82
+ mkError = responseError . (" Fourmolu: " <> ) . T. pack
82
83
lspPrinterOpts = mempty {poIndentation = Just $ fromIntegral $ fo ^. tabSize}
83
84
region = case typ of
84
85
FormatText ->
85
86
RegionIndices Nothing Nothing
86
87
FormatRange (Range (Position sl _) (Position el _)) ->
87
88
RegionIndices (Just $ fromIntegral $ sl + 1 ) (Just $ fromIntegral $ el + 1 )
88
89
89
- convertDynFlags :: DynFlags -> IO [ DynOption ]
90
+ convertDynFlags :: Monad m => DynFlags -> m [ String ]
90
91
convertDynFlags df =
91
92
let pp = [" -pgmF=" <> p | not (null p)]
92
93
p = sPgm_F $ Compat. settings df
@@ -95,4 +96,4 @@ convertDynFlags df =
95
96
showExtension = \ case
96
97
Cpp -> " -XCPP"
97
98
x -> " -X" ++ show x
98
- in return $ map DynOption $ pp <> pm <> ex
99
+ in return $ pp <> pm <> ex
You can’t perform that action at this time.
0 commit comments