Skip to content

Commit f2b69de

Browse files
committed
use noopDebouncer when testing
1 parent a8179ce commit f2b69de

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

ghcide/src/Development/IDE/Core/Debouncer.hs

+2-4
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ asyncRegisterEvent d delay k fire = join $ atomicallyNamed "debouncer - register
4040
prev <- STM.lookup k d
4141
case prev of
4242
Just v -> writeTVar v (delay, fire) >> return (pure ())
43-
Nothing
44-
| delay == 0 -> return fire
45-
| otherwise -> do
43+
Nothing -> do
4644
var <- newTVar (delay, fire)
4745
STM.insert var k d
4846
return $ void $ async $
@@ -52,6 +50,6 @@ asyncRegisterEvent d delay k fire = join $ atomicallyNamed "debouncer - register
5250
STM.delete k d
5351
return act
5452

55-
-- | Debouncer used in the DAML CLI compiler that emits events immediately.
53+
-- | Debouncer that emits events immediately.
5654
noopDebouncer :: Debouncer k
5755
noopDebouncer = Debouncer $ \_ _ a -> a

ghcide/src/Development/IDE/Main.hs

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ module Development.IDE.Main
1111
,testing) where
1212
import Control.Concurrent.Extra (newLock, withLock,
1313
withNumCapabilities)
14-
import Control.Concurrent.STM.Stats (atomically, dumpSTMStats)
14+
import Control.Concurrent.STM.Stats (atomically,
15+
dumpSTMStats)
1516
import Control.Exception.Safe (Exception (displayException),
1617
catchAny)
1718
import Control.Monad.Extra (concatMapM, unless,
@@ -34,7 +35,8 @@ import Development.IDE (Action, GhcVersion (..),
3435
ghcVersion,
3536
hDuplicateTo')
3637
import Development.IDE.Core.Debouncer (Debouncer,
37-
newAsyncDebouncer)
38+
newAsyncDebouncer,
39+
noopDebouncer)
3840
import Development.IDE.Core.FileStore (isWatchSupported,
3941
makeVFSHandle)
4042
import Development.IDE.Core.IdeConfiguration (IdeConfiguration (..),
@@ -225,6 +227,7 @@ testing = (defaultArguments Debug) {
225227
argsHlsPlugins = pluginDescToIdePlugins $
226228
idePluginsToPluginDesc (argsHlsPlugins def)
227229
++ [Test.blockCommandDescriptor "block-command", Test.plugin],
230+
argsDebouncer = pure noopDebouncer,
228231
argsIdeOptions = \config sessionLoader ->
229232
let defOptions = argsIdeOptions def config sessionLoader
230233
in defOptions {

0 commit comments

Comments
 (0)