Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 671d5ef

Browse files
committed
Merge remote-tracking branch 'bubba/window-progress' into hie-bios
2 parents 0f0c250 + 1bf711f commit 671d5ef

18 files changed

+147
-42
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434

3535
[submodule "submodules/floskell"]
3636
path = submodules/floskell
37+
url = https://github.com/ennocramer/floskell
3738
# url = https://github.com/alanz/floskell
38-
url = https://github.com/ennocramer/floskell
3939
[submodule "haskell-lsp"]
4040
path = haskell-lsp
4141
url = https://github.com/mpickering/haskell-lsp.git

haskell-ide-engine.cabal

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ test-suite unit-test
188188
, filepath
189189
, free
190190
, haskell-ide-engine
191-
, haskell-lsp-types >= 0.4
191+
, haskell-lsp-types
192192
, hie-test-utils
193193
, hie-plugin-api
194194
, hoogle > 5.0.11
@@ -264,6 +264,7 @@ test-suite func-test
264264
, HaReSpec
265265
, HighlightSpec
266266
, HoverSpec
267+
, ProgressSpec
267268
, ReferencesSpec
268269
, RenameSpec
269270
, SymbolsSpec
@@ -276,9 +277,9 @@ test-suite func-test
276277
, data-default
277278
, directory
278279
, filepath
279-
, lsp-test >= 0.5.1.1 && < 0.5.2
280+
, lsp-test >= 0.5.1.3
280281
, haskell-ide-engine
281-
, haskell-lsp-types >= 0.4
282+
, haskell-lsp-types == 0.10.*
282283
, hie-test-utils
283284
, hie-plugin-api
284285
, hspec

hie-plugin-api/Haskell/Ide/Engine/PluginsIdeMonads.hs

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ module Haskell.Ide.Engine.PluginsIdeMonads
5151
, runIdeM
5252
, IdeDeferM
5353
, MonadIde(..)
54+
, Core.Progress(..)
5455
, iterT
5556
, LiftsToGhc(..)
5657
-- * IdeResult
@@ -214,8 +215,8 @@ data FormattingType = FormatDocument
214215
-- | Formats the given Text associated with the given Uri.
215216
-- Should, but might not, honor the provided formatting options (e.g. Floskell does not).
216217
-- A formatting type can be given to either format the whole document or only a Range.
217-
--
218-
-- Text to format, may or may not, originate from the associated Uri.
218+
--
219+
-- Text to format, may or may not, originate from the associated Uri.
219220
-- E.g. it is ok, to modify the text and then reformat it through this API.
220221
--
221222
-- The Uri is mainly used to discover formatting configurations in the file's path.
@@ -353,16 +354,23 @@ data IdeEnv = IdeEnv
353354
}
354355

355356
-- | The class of monads that support common IDE functions, namely IdeM/IdeGhcM/IdeDeferM
356-
class Monad m => MonadIde m where
357+
class MonadIO m => MonadIde m where
357358
getRootPath :: m (Maybe FilePath)
358359
getVirtualFile :: Uri -> m (Maybe VirtualFile)
359360
persistVirtualFile :: Uri -> m FilePath
360361
reverseFileMap :: m (FilePath -> FilePath)
361362
getConfig :: m Config
362363
getClientCapabilities :: m ClientCapabilities
363364
getPlugins :: m IdePlugins
364-
365-
instance MonadIde IdeM where
365+
-- 'withProgress' @title f@ wraps a progress reporting session for long running tasks.
366+
-- f is passed a reporting function that can be used to give updates on the progress
367+
-- of the task.
368+
withProgress :: T.Text -> ((Core.Progress -> m ()) -> m a) -> m a
369+
-- 'withIndefiniteProgress' @title f@ is the same as the 'withProgress' but for tasks
370+
-- which do not continuously report their progress.
371+
withIndefiniteProgress :: T.Text -> m a -> m a
372+
373+
instance MonadIO m => MonadIde (ReaderT IdeEnv m) where
366374
getRootPath = do
367375
mlf <- asks ideEnvLspFuncs
368376
case mlf of
@@ -402,6 +410,14 @@ instance MonadIde IdeM where
402410

403411
getPlugins = asks idePlugins
404412

413+
withProgress t f = do
414+
lf <- asks ideEnvLspFuncs
415+
withProgress' lf t f
416+
417+
withIndefiniteProgress t f = do
418+
lf <- asks ideEnvLspFuncs
419+
withIndefiniteProgress' lf t f
420+
405421
instance MonadTrans GhcT where
406422
lift m = liftGhcT m
407423

@@ -413,6 +429,12 @@ instance MonadIde IdeGhcM where
413429
getConfig = lift getConfig
414430
getClientCapabilities = lift getClientCapabilities
415431
getPlugins = lift getPlugins
432+
withProgress t f = do
433+
lf <- lift $ asks ideEnvLspFuncs
434+
withProgress' lf t f
435+
withIndefiniteProgress t f = do
436+
lf <- lift $ asks ideEnvLspFuncs
437+
withIndefiniteProgress' lf t f
416438

417439

418440
instance MonadIde IdeDeferM where
@@ -423,6 +445,26 @@ instance MonadIde IdeDeferM where
423445
getConfig = lift getConfig
424446
getClientCapabilities = lift getClientCapabilities
425447
getPlugins = lift getPlugins
448+
withProgress t f = do
449+
lf <- lift $ asks ideEnvLspFuncs
450+
withProgress' lf t f
451+
withIndefiniteProgress t f = do
452+
lf <- lift $ asks ideEnvLspFuncs
453+
withIndefiniteProgress' lf t f
454+
455+
withProgress' :: MonadIO m => Maybe (Core.LspFuncs Config) -> T.Text -> ((Core.Progress -> m ()) -> m a) -> m a
456+
withProgress' lspFuncs t f =
457+
let mWp = Core.withProgress <$> lspFuncs
458+
in case mWp of
459+
Nothing -> f (const $ return ())
460+
Just wp -> wp t f
461+
462+
withIndefiniteProgress' :: MonadIO m => Maybe (Core.LspFuncs Config) -> T.Text -> m a -> m a
463+
withIndefiniteProgress' lspFuncs t f =
464+
let mWp = Core.withIndefiniteProgress <$> lspFuncs
465+
in case mWp of
466+
Nothing -> f
467+
Just wp -> wp t f
426468

427469
data IdeState = IdeState
428470
{ moduleCache :: GhcModuleCache

hie-plugin-api/hie-plugin-api.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ library
4747
, ghc
4848
, ghc-mod-core >= 5.9.0.0
4949
, hie-bios
50-
, haskell-lsp >= 0.8
50+
, haskell-lsp == 0.10.*
5151
, hslogger
5252
, monad-control
5353
, mtl

src/Haskell/Ide/Engine/Plugin/Bios.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import Data.Monoid ((<>))
1515
import qualified Data.Set as Set
1616
import qualified Data.Text as T
1717
import ErrUtils
18+
import System.FilePath
1819

1920
import Haskell.Ide.Engine.MonadFunctions
2021
import Haskell.Ide.Engine.MonadTypes
@@ -202,7 +203,8 @@ setTypecheckedModule_load uri =
202203
mapped_fp <- persistVirtualFile uri
203204
liftIO $ copyHsBoot fp mapped_fp
204205
rfm <- reverseFileMap
205-
(diags', errs, mmods) <- (captureDiagnostics rfm $ BIOS.loadFile (fp, mapped_fp))
206+
let progTitle = "Typechecking " <> T.pack (takeFileName fp)
207+
(diags', errs, mmods) <- withIndefiniteProgress progTitle (captureDiagnostics rfm $ BIOS.loadFile (fp, mapped_fp))
206208
debugm "File, loaded"
207209
canonUri <- canonicalizeUri uri
208210
let diags = Map.insertWith Set.union canonUri Set.empty diags'

src/Haskell/Ide/Engine/Plugin/Generic.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import Data.List
1616
import Data.Maybe
1717
import Data.Monoid ((<>))
1818
import qualified Data.Text as T
19+
import System.FilePath
20+
import ErrUtils
1921
import Name
2022
import GHC.Generics
2123
import Haskell.Ide.Engine.MonadFunctions

src/Haskell/Ide/Engine/Plugin/Liquid.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ diagnosticProvider DiagnosticOnSave uri cb = pluginGetFile "Liquid.diagnosticPro
120120
LiquidData mtid <- get
121121
mapM_ (liftIO . cancel) mtid
122122

123-
tid <- liftIO $ async $ generateDiagnosics cb uri file
123+
let progTitle = "Running Liquid Haskell on " <> T.pack (takeFileName file)
124+
tid <- withIndefiniteProgress progTitle $
125+
liftIO $ async $ generateDiagnosics cb uri file
124126
put (LiquidData (Just tid))
125127

126128
return $ IdeResultOk ()

stack-8.2.1.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ extra-deps:
1919
- ghc-exactprint-0.5.8.2
2020
- haddock-api-2.18.1
2121
- haddock-library-1.4.4
22-
- haskell-lsp-0.9.0.0
23-
- haskell-lsp-types-0.9.0.0
22+
- haskell-lsp-0.10.0.0
23+
- haskell-lsp-types-0.10.0.0
2424
- hlint-2.0.11
2525
- hsimport-0.8.6
26-
- lsp-test-0.5.1.1
26+
- lsp-test-0.5.1.3
2727
- monad-dijkstra-0.1.1.2
2828
- mtl-2.2.2
2929
- pretty-show-1.8.2

stack-8.2.2.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ extra-deps:
2020
- ghc-exactprint-0.5.8.2
2121
- haddock-api-2.18.1
2222
- haddock-library-1.4.4
23-
- haskell-lsp-0.9.0.0
24-
- haskell-lsp-types-0.9.0.0
23+
- haskell-lsp-0.10.0.0
24+
- haskell-lsp-types-0.10.0.0
2525
- haskell-src-exts-1.21.0
2626
- haskell-src-exts-util-0.2.5
2727
- hlint-2.1.16
2828
- hoogle-5.0.17.6
2929
- hsimport-0.8.8
30-
- lsp-test-0.5.1.1
30+
- lsp-test-0.5.1.3
3131
- monad-dijkstra-0.1.1.2
3232
- pretty-show-1.8.2
3333
- sorted-list-0.2.1.0

stack-8.4.2.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ extra-deps:
1818
- ghc-exactprint-0.5.8.2
1919
- haddock-api-2.20.0
2020
- haddock-library-1.6.0
21-
- haskell-lsp-0.9.0.0
22-
- haskell-lsp-types-0.9.0.0
21+
- haskell-lsp-0.10.0.0
22+
- haskell-lsp-types-0.10.0.0
2323
- haskell-src-exts-1.21.0
2424
- haskell-src-exts-util-0.2.5
2525
- hlint-2.1.16
2626
- hoogle-5.0.17.6
2727
- hsimport-0.8.8
28-
- lsp-test-0.5.1.1
28+
- lsp-test-0.5.1.3
2929
- monad-dijkstra-0.1.1.2
3030
- pretty-show-1.8.2
3131
- syz-0.2.0.0

stack-8.4.3.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ extra-deps:
1717
- ghc-exactprint-0.5.8.2
1818
- haddock-api-2.20.0
1919
- haddock-library-1.6.0
20-
- haskell-lsp-0.9.0.0
21-
- haskell-lsp-types-0.9.0.0
20+
- haskell-lsp-0.10.0.0
21+
- haskell-lsp-types-0.10.0.0
2222
- haskell-src-exts-1.21.0
2323
- haskell-src-exts-util-0.2.5
2424
- hlint-2.1.16
2525
- hoogle-5.0.17.6
2626
- hsimport-0.8.8
27-
- lsp-test-0.5.1.1
27+
- lsp-test-0.5.1.3
2828
- monad-dijkstra-0.1.1.2
2929
- pretty-show-1.8.2
3030
- syz-0.2.0.0

stack-8.4.4.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ extra-deps:
1717
- ghc-exactprint-0.5.8.2
1818
- haddock-api-2.20.0
1919
- haddock-library-1.6.0
20-
- haskell-lsp-0.9.0.0
21-
- haskell-lsp-types-0.9.0.0
20+
- haskell-lsp-0.10.0.0
21+
- haskell-lsp-types-0.10.0.0
2222
- haskell-src-exts-1.21.0
2323
- haskell-src-exts-util-0.2.5
2424
- hlint-2.1.16
2525
- hoogle-5.0.17.6
2626
- hsimport-0.8.8
27-
- lsp-test-0.5.1.1
27+
- lsp-test-0.5.1.3
2828
- monad-dijkstra-0.1.1.2
2929
- optparse-simple-0.1.0
3030
- pretty-show-1.9.5

stack-8.6.1.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ extra-deps:
1919
- czipwith-1.0.1.1
2020
- data-tree-print-0.1.0.2
2121
- haddock-api-2.21.0
22-
- haskell-lsp-0.9.0.0
23-
- haskell-lsp-types-0.9.0.0
22+
- haskell-lsp-0.10.0.0
23+
- haskell-lsp-types-0.10.0.0
2424
- haskell-src-exts-1.21.0
2525
- haskell-src-exts-util-0.2.5
2626
- hlint-2.1.16
2727
- hoogle-5.0.17.6
2828
- hsimport-0.8.8
29-
- lsp-test-0.5.1.1
29+
- lsp-test-0.5.1.3
3030
- monad-dijkstra-0.1.1.2
3131
- monad-memo-0.4.1
3232
- monoid-subclasses-0.4.6.1

stack-8.6.2.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ extra-deps:
1515
- cabal-plan-0.4.0.0
1616
- constrained-dynamic-0.1.0.0
1717
- haddock-api-2.21.0
18-
- haskell-lsp-0.9.0.0
19-
- haskell-lsp-types-0.9.0.0
18+
- haskell-lsp-0.10.0.0
19+
- haskell-lsp-types-0.10.0.0
2020
- haskell-src-exts-1.21.0
2121
- haskell-src-exts-util-0.2.5
2222
- hlint-2.1.16
2323
- hoogle-5.0.17.6
2424
- hsimport-0.8.8
25-
- lsp-test-0.5.1.1
25+
- lsp-test-0.5.1.3
2626
- monad-dijkstra-0.1.1.2
2727
- monad-memo-0.4.1
2828
- multistate-0.8.0.1

stack-8.6.3.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ extra-deps:
1919
- cabal-plan-0.4.0.0
2020
- constrained-dynamic-0.1.0.0
2121
- haddock-api-2.21.0
22-
- haskell-lsp-0.9.0.0
23-
- haskell-lsp-types-0.9.0.0
22+
- haskell-lsp-0.10.0.0
23+
- haskell-lsp-types-0.10.0.0
2424
- haskell-src-exts-1.21.0
2525
- haskell-src-exts-util-0.2.5
2626
- hlint-2.1.16
2727
- hoogle-5.0.17.6
2828
- hsimport-0.8.8
29-
- lsp-test-0.5.1.1
29+
- lsp-test-0.5.1.3
3030
- monad-dijkstra-0.1.1.2
3131
- monad-memo-0.4.1
3232
- multistate-0.8.0.1

stack-8.6.4.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ extra-deps:
1919
- cabal-plan-0.4.0.0
2020
- constrained-dynamic-0.1.0.0
2121
- haddock-api-2.22.0
22-
- haskell-lsp-0.9.0.0
23-
- haskell-lsp-types-0.9.0.0
22+
- haskell-lsp-0.10.0.0
23+
- haskell-lsp-types-0.10.0.0
2424
- haskell-src-exts-1.21.0
2525
- haskell-src-exts-util-0.2.5
2626
- hlint-2.1.16
2727
- hoogle-5.0.17.6
2828
- hsimport-0.8.8
29-
- lsp-test-0.5.1.1
29+
- lsp-test-0.5.1.3
3030
- monad-dijkstra-0.1.1.2@rev:1
3131
- monad-memo-0.4.1
3232
- multistate-0.8.0.1

stack.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ extra-deps:
2121
- deque-0.2.7
2222
- ghc-exactprint-0.5.8.2
2323
- haddock-api-2.22.0
24-
- haskell-lsp-0.9.0.0
25-
- haskell-lsp-types-0.9.0.0
24+
- haskell-lsp-0.10.0.0
25+
- haskell-lsp-types-0.10.0.0
2626
- haskell-src-exts-util-0.2.5
2727
- hlint-2.1.16
2828
- hsimport-0.8.8
29-
- lsp-test-0.5.1.1
29+
- lsp-test-0.5.1.3
3030
- monad-dijkstra-0.1.1.2@rev:1
3131
- monad-memo-0.4.1
3232
- multistate-0.8.0.1

0 commit comments

Comments
 (0)