@@ -58,7 +58,9 @@ import Development.IDE.Test (Cursor,
58
58
standardizeQuotes ,
59
59
waitForAction ,
60
60
waitForGC ,
61
- waitForTypecheck )
61
+ waitForTypecheck ,
62
+ isReferenceReady ,
63
+ referenceReady )
62
64
import Development.IDE.Test.Runfiles
63
65
import qualified Development.IDE.Types.Diagnostics as Diagnostics
64
66
import Development.IDE.Types.Location
@@ -5534,11 +5536,7 @@ simpleMultiDefTest = testCase "simple-multi-def-test" $ runWithExtraFiles "multi
5534
5536
adoc <- liftIO $ runInDir dir $ do
5535
5537
aSource <- liftIO $ readFileUtf8 aPath
5536
5538
adoc <- createDoc aPath " haskell" aSource
5537
- ~ () <- skipManyTill anyMessage $ satisfyMaybe $ \ case
5538
- FromServerMess (SCustomMethod " ghcide/reference/ready" ) (NotMess NotificationMessage {_params = fp}) -> do
5539
- A. Success fp' <- pure $ fromJSON fp
5540
- if equalFilePath fp' aPath then pure () else Nothing
5541
- _ -> Nothing
5539
+ skipManyTill anyMessage $ isReferenceReady aPath
5542
5540
closeDoc adoc
5543
5541
pure adoc
5544
5542
bSource <- liftIO $ readFileUtf8 bPath
@@ -5566,11 +5564,7 @@ bootTests = testGroup "boot"
5566
5564
liftIO $ runInDir dir $ do
5567
5565
cDoc <- createDoc cPath " haskell" cSource
5568
5566
_ <- getHover cDoc $ Position 4 3
5569
- ~ () <- skipManyTill anyMessage $ satisfyMaybe $ \ case
5570
- FromServerMess (SCustomMethod " ghcide/reference/ready" ) (NotMess NotificationMessage {_params = fp}) -> do
5571
- A. Success fp' <- pure $ fromJSON fp
5572
- if equalFilePath fp' cPath then pure () else Nothing
5573
- _ -> Nothing
5567
+ skipManyTill anyMessage $ isReferenceReady cPath
5574
5568
closeDoc cDoc
5575
5569
cdoc <- createDoc cPath " haskell" cSource
5576
5570
locs <- getDefinitions cdoc (Position 7 4 )
@@ -5980,11 +5974,7 @@ referenceTestSession name thisDoc docs' f = testSessionWithExtraFiles "reference
5980
5974
loop :: [FilePath ] -> Session ()
5981
5975
loop [] = pure ()
5982
5976
loop docs = do
5983
- doc <- skipManyTill anyMessage $ satisfyMaybe $ \ case
5984
- FromServerMess (SCustomMethod " ghcide/reference/ready" ) (NotMess NotificationMessage {_params = fp}) -> do
5985
- A. Success fp' <- pure $ fromJSON fp
5986
- find (fp' == ) docs
5987
- _ -> Nothing
5977
+ doc <- skipManyTill anyMessage $ referenceReady (`elem` docs)
5988
5978
loop (delete doc docs)
5989
5979
loop docs
5990
5980
f dir
0 commit comments