File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
plugins/hls-fourmolu-plugin/src/Ide/Plugin Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -44,10 +44,9 @@ descriptor plId =
4444
4545provider :: FormattingHandler IdeState
4646provider 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)
5150 useCLI <- formattingCLI <$> getConfig
5251 if useCLI
5352 then liftIO
@@ -116,7 +115,7 @@ provider ideState typ contents fp fo = withIndefiniteProgress title Cancellable
116115 FormatRange (Range (Position sl _) (Position el _)) ->
117116 RegionIndices (Just $ fromIntegral $ sl + 1 ) (Just $ fromIntegral $ el + 1 )
118117
119- convertDynFlags :: Monad m => DynFlags -> m [String ]
118+ convertDynFlags :: DynFlags -> [String ]
120119convertDynFlags df =
121120 let pp = [" -pgmF=" <> p | not (null p)]
122121 p = sPgm_F $ Compat. settings df
@@ -125,4 +124,4 @@ convertDynFlags df =
125124 showExtension = \ case
126125 Cpp -> " -XCPP"
127126 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