Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit afad717

Browse files
committed
hls-notes-plugin: Wait until HLS is done in tests
1 parent c5eeaee commit afad717

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

plugins/hls-notes-plugin/test/NotesTest.hs

+8-3
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,33 @@ gotoNoteTests :: TestTree
1919
gotoNoteTests = testGroup "Goto Note Definition"
2020
[ testCase "single_file" $ runSessionWithServer def plugin testDataDir $ do
2121
doc <- openDoc "NoteDef.hs" "haskell"
22-
_ <- waitForAllProgressDone
22+
waitForCustomMessage "ghcide/cradle/loaded" (const $ Just ())
23+
waitForAllProgressDone
2324
defs <- getDefinitions doc (Position 3 41)
2425
liftIO $ do
2526
fp <- canonicalizePath "NoteDef.hs"
2627
defs @?= InL (Definition (InR [Location (filePathToUri fp) (Range (Position 8 9) (Position 8 9))]))
2728
, testCase "liberal_format" $ runSessionWithServer def plugin testDataDir $ do
2829
doc <- openDoc "NoteDef.hs" "haskell"
29-
_ <- waitForAllProgressDone
30+
waitForCustomMessage "ghcide/cradle/loaded" (const $ Just ())
31+
waitForAllProgressDone
3032
defs <- getDefinitions doc (Position 5 64)
3133
liftIO $ do
3234
fp <- canonicalizePath "NoteDef.hs"
3335
defs @?= InL (Definition (InR [Location (filePathToUri fp) (Range (Position 18 11) (Position 18 11))]))
3436

3537
, testCase "invalid_note" $ runSessionWithServer def plugin testDataDir $ do
3638
doc <- openDoc "NoteDef.hs" "haskell"
37-
_ <- waitForAllProgressDone
39+
waitForCustomMessage "ghcide/cradle/loaded" (const $ Just ())
40+
waitForAllProgressDone
3841
defs <- getDefinitions doc (Position 6 54)
3942
liftIO $ do
4043
defs @?= InL (Definition (InR []))
4144

4245
, testCase "no_note" $ runSessionWithServer def plugin testDataDir $ do
4346
doc <- openDoc "NoteDef.hs" "haskell"
47+
waitForCustomMessage "ghcide/cradle/loaded" (const $ Just ())
48+
waitForAllProgressDone
4449
defs <- getDefinitions doc (Position 1 0)
4550
liftIO $ defs @?= InL (Definition (InR []))
4651

0 commit comments

Comments
 (0)