Skip to content

Commit

Permalink
use noopDebouncer when testing
Browse files Browse the repository at this point in the history
  • Loading branch information
pepeiborra committed Dec 11, 2021
1 parent a8179ce commit f2b69de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 2 additions & 4 deletions ghcide/src/Development/IDE/Core/Debouncer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ asyncRegisterEvent d delay k fire = join $ atomicallyNamed "debouncer - register
prev <- STM.lookup k d
case prev of
Just v -> writeTVar v (delay, fire) >> return (pure ())
Nothing
| delay == 0 -> return fire
| otherwise -> do
Nothing -> do
var <- newTVar (delay, fire)
STM.insert var k d
return $ void $ async $
Expand All @@ -52,6 +50,6 @@ asyncRegisterEvent d delay k fire = join $ atomicallyNamed "debouncer - register
STM.delete k d
return act

-- | Debouncer used in the DAML CLI compiler that emits events immediately.
-- | Debouncer that emits events immediately.
noopDebouncer :: Debouncer k
noopDebouncer = Debouncer $ \_ _ a -> a
7 changes: 5 additions & 2 deletions ghcide/src/Development/IDE/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ module Development.IDE.Main
,testing) where
import Control.Concurrent.Extra (newLock, withLock,
withNumCapabilities)
import Control.Concurrent.STM.Stats (atomically, dumpSTMStats)
import Control.Concurrent.STM.Stats (atomically,
dumpSTMStats)
import Control.Exception.Safe (Exception (displayException),
catchAny)
import Control.Monad.Extra (concatMapM, unless,
Expand All @@ -34,7 +35,8 @@ import Development.IDE (Action, GhcVersion (..),
ghcVersion,
hDuplicateTo')
import Development.IDE.Core.Debouncer (Debouncer,
newAsyncDebouncer)
newAsyncDebouncer,
noopDebouncer)
import Development.IDE.Core.FileStore (isWatchSupported,
makeVFSHandle)
import Development.IDE.Core.IdeConfiguration (IdeConfiguration (..),
Expand Down Expand Up @@ -225,6 +227,7 @@ testing = (defaultArguments Debug) {
argsHlsPlugins = pluginDescToIdePlugins $
idePluginsToPluginDesc (argsHlsPlugins def)
++ [Test.blockCommandDescriptor "block-command", Test.plugin],
argsDebouncer = pure noopDebouncer,
argsIdeOptions = \config sessionLoader ->
let defOptions = argsIdeOptions def config sessionLoader
in defOptions {
Expand Down

0 comments on commit f2b69de

Please # to comment.