File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,11 @@ import GhcPlugins (HscEnv (hsc_dflags))
2626import Ide.Plugin.Formatter
2727import Ide.PluginUtils
2828import Ide.Types
29+ import Language.Haskell.LSP.Core (LspFuncs (withIndefiniteProgress ),
30+ ProgressCancellable (Cancellable ))
2931import Language.Haskell.LSP.Types
3032import Ormolu
33+ import System.FilePath (takeFileName )
3134import Text.Regex.TDFA.Text ()
3235
3336-- ---------------------------------------------------------------------
@@ -40,7 +43,7 @@ descriptor plId = (defaultPluginDescriptor plId)
4043-- ---------------------------------------------------------------------
4144
4245provider :: FormattingProvider IO
43- provider _lf ideState typ contents fp _ = do
46+ provider lf ideState typ contents fp _ = withIndefiniteProgress lf title Cancellable $ do
4447 let
4548 fromDyn :: DynFlags -> IO [DynOption ]
4649 fromDyn df =
@@ -75,6 +78,7 @@ provider _lf ideState typ contents fp _ = do
7578 in
7679 ret <$> fmt contents (mkConf fileOpts (rangeRegion sl el))
7780 where
81+ title = T. pack $ " Formatting " <> takeFileName (fromNormalizedFilePath fp)
7882 ret :: Either OrmoluException T. Text -> Either ResponseError (List TextEdit )
7983 ret (Left err) = Left
8084 (responseError (T. pack $ " ormoluCmd: " ++ show err) )
You can’t perform that action at this time.
0 commit comments