File tree 1 file changed +5
-1
lines changed
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))
26
26
import Ide.Plugin.Formatter
27
27
import Ide.PluginUtils
28
28
import Ide.Types
29
+ import Language.Haskell.LSP.Core (LspFuncs (withIndefiniteProgress ),
30
+ ProgressCancellable (Cancellable ))
29
31
import Language.Haskell.LSP.Types
30
32
import Ormolu
33
+ import System.FilePath (takeFileName )
31
34
import Text.Regex.TDFA.Text ()
32
35
33
36
-- ---------------------------------------------------------------------
@@ -40,7 +43,7 @@ descriptor plId = (defaultPluginDescriptor plId)
40
43
-- ---------------------------------------------------------------------
41
44
42
45
provider :: FormattingProvider IO
43
- provider _lf ideState typ contents fp _ = do
46
+ provider lf ideState typ contents fp _ = withIndefiniteProgress lf title Cancellable $ do
44
47
let
45
48
fromDyn :: DynFlags -> IO [DynOption ]
46
49
fromDyn df =
@@ -75,6 +78,7 @@ provider _lf ideState typ contents fp _ = do
75
78
in
76
79
ret <$> fmt contents (mkConf fileOpts (rangeRegion sl el))
77
80
where
81
+ title = T. pack $ " Formatting " <> takeFileName (fromNormalizedFilePath fp)
78
82
ret :: Either OrmoluException T. Text -> Either ResponseError (List TextEdit )
79
83
ret (Left err) = Left
80
84
(responseError (T. pack $ " ormoluCmd: " ++ show err) )
You can’t perform that action at this time.
0 commit comments