File tree 1 file changed +5
-6
lines changed
plugins/hls-fourmolu-plugin/src/Ide/Plugin
1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -44,10 +44,9 @@ descriptor plId =
44
44
45
45
provider :: FormattingHandler IdeState
46
46
provider ideState typ contents fp fo = withIndefiniteProgress title Cancellable $ do
47
- ghc <- liftIO $ runAction " Fourmolu" ideState $ use GhcSession fp
48
- fileOpts <- case hsc_dflags . hscEnv <$> ghc of
49
- Nothing -> return []
50
- Just df -> liftIO $ convertDynFlags df
47
+ fileOpts <-
48
+ maybe [] (convertDynFlags . hsc_dflags . hscEnv)
49
+ <$> liftIO (runAction " Fourmolu" ideState $ use GhcSession fp)
51
50
useCLI <- formattingCLI <$> getConfig
52
51
if useCLI
53
52
then liftIO
@@ -116,7 +115,7 @@ provider ideState typ contents fp fo = withIndefiniteProgress title Cancellable
116
115
FormatRange (Range (Position sl _) (Position el _)) ->
117
116
RegionIndices (Just $ fromIntegral $ sl + 1 ) (Just $ fromIntegral $ el + 1 )
118
117
119
- convertDynFlags :: Monad m => DynFlags -> m [String ]
118
+ convertDynFlags :: DynFlags -> [String ]
120
119
convertDynFlags df =
121
120
let pp = [" -pgmF=" <> p | not (null p)]
122
121
p = sPgm_F $ Compat. settings df
@@ -125,4 +124,4 @@ convertDynFlags df =
125
124
showExtension = \ case
126
125
Cpp -> " -XCPP"
127
126
x -> " -X" ++ show x
128
- in return $ pp <> pm <> ex
127
+ in pp <> pm <> ex
You can’t perform that action at this time.
0 commit comments