@@ -19,6 +19,7 @@ tests = testGroup "completions" [
19
19
let te = TextEdit (Range (Position 5 7 ) (Position 5 24 )) " put"
20
20
_ <- applyEdit doc te
21
21
22
+ _ <- waitForDiagnostics
22
23
compls <- getCompletions doc (Position 5 9 )
23
24
item <- getCompletionByLabel " putStrLn" compls
24
25
liftIO $ do
@@ -35,6 +36,7 @@ tests = testGroup "completions" [
35
36
let te = TextEdit (Range (Position 5 7 ) (Position 5 24 )) " put"
36
37
_ <- applyEdit doc te
37
38
39
+ _ <- waitForDiagnostics
38
40
compls <- getCompletions doc (Position 5 9 )
39
41
item <- getCompletionByLabel " putStrLn" compls
40
42
resolvedRes <- request SCompletionItemResolve item
@@ -56,6 +58,7 @@ tests = testGroup "completions" [
56
58
let te = TextEdit (Range (Position 1 17 ) (Position 1 26 )) " Data.M"
57
59
_ <- applyEdit doc te
58
60
61
+ _ <- waitForDiagnostics
59
62
compls <- getCompletions doc (Position 1 23 )
60
63
item <- getCompletionByLabel " Maybe" compls
61
64
liftIO $ do
@@ -81,6 +84,7 @@ tests = testGroup "completions" [
81
84
, testCase " completes with no prefix" $ runSession hlsCommand fullCaps " test/testdata/completion" $ do
82
85
doc <- openDoc " Completion.hs" " haskell"
83
86
87
+ _ <- waitForDiagnostics
84
88
compls <- getCompletions doc (Position 5 7 )
85
89
liftIO $ assertBool " Expected completions" $ not $ null compls
86
90
@@ -91,6 +95,7 @@ tests = testGroup "completions" [
91
95
let te = TextEdit (Range (Position 5 0 ) (Position 5 2 )) " acc"
92
96
_ <- applyEdit doc te
93
97
98
+ _ <- waitForDiagnostics
94
99
compls <- getCompletions doc (Position 5 4 )
95
100
item <- getCompletionByLabel " accessor" compls
96
101
liftIO $ do
@@ -101,6 +106,7 @@ tests = testGroup "completions" [
101
106
102
107
let te = TextEdit (Range (Position 5 7 ) (Position 5 9 )) " id"
103
108
_ <- applyEdit doc te
109
+ _ <- waitForDiagnostics
104
110
compls <- getCompletions doc (Position 5 9 )
105
111
item <- getCompletionByLabel " id" compls
106
112
liftIO $ do
@@ -111,6 +117,7 @@ tests = testGroup "completions" [
111
117
112
118
let te = TextEdit (Range (Position 5 7 ) (Position 5 24 )) " flip"
113
119
_ <- applyEdit doc te
120
+ _ <- waitForDiagnostics
114
121
compls <- getCompletions doc (Position 5 11 )
115
122
item <- getCompletionByLabel " flip" compls
116
123
liftIO $
@@ -119,6 +126,7 @@ tests = testGroup "completions" [
119
126
, testCase " maxCompletions" $ runSession hlsCommand fullCaps " test/testdata/completion" $ do
120
127
doc <- openDoc " Completion.hs" " haskell"
121
128
129
+ _ <- waitForDiagnostics
122
130
compls <- getCompletions doc (Position 5 7 )
123
131
liftIO $ length compls @?= maxCompletions def
124
132
@@ -128,6 +136,7 @@ tests = testGroup "completions" [
128
136
let te = TextEdit (Range (Position 0 30 ) (Position 0 41 )) " A"
129
137
_ <- applyEdit doc te
130
138
139
+ _ <- waitForDiagnostics
131
140
compls <- getCompletions doc (Position 0 31 )
132
141
item <- getCompletionByLabel " Alternative" compls
133
142
liftIO $ do
@@ -141,6 +150,7 @@ tests = testGroup "completions" [
141
150
let te = TextEdit (Range (Position 0 39 ) (Position 0 39 )) " , l"
142
151
_ <- applyEdit doc te
143
152
153
+ _ <- waitForDiagnostics
144
154
compls <- getCompletions doc (Position 0 42 )
145
155
item <- getCompletionByLabel " liftA" compls
146
156
liftIO $ do
@@ -159,6 +169,7 @@ snippetTests = testGroup "snippets" [
159
169
let te = TextEdit (Range (Position 5 7 ) (Position 5 24 )) " Nothing"
160
170
_ <- applyEdit doc te
161
171
172
+ _ <- waitForDiagnostics
162
173
compls <- getCompletions doc (Position 5 14 )
163
174
item <- getCompletionByLabel " Nothing" compls
164
175
liftIO $ do
@@ -171,6 +182,7 @@ snippetTests = testGroup "snippets" [
171
182
let te = TextEdit (Range (Position 5 7 ) (Position 5 24 )) " fold"
172
183
_ <- applyEdit doc te
173
184
185
+ _ <- waitForDiagnostics
174
186
compls <- getCompletions doc (Position 5 11 )
175
187
item <- getCompletionByLabel " foldl" compls
176
188
liftIO $ do
@@ -185,6 +197,7 @@ snippetTests = testGroup "snippets" [
185
197
let te = TextEdit (Range (Position 5 7 ) (Position 5 24 )) " mapM"
186
198
_ <- applyEdit doc te
187
199
200
+ _ <- waitForDiagnostics
188
201
compls <- getCompletions doc (Position 5 11 )
189
202
item <- getCompletionByLabel " mapM" compls
190
203
liftIO $ do
@@ -199,6 +212,7 @@ snippetTests = testGroup "snippets" [
199
212
let te = TextEdit (Range (Position 5 7 ) (Position 5 24 )) " even `filte"
200
213
_ <- applyEdit doc te
201
214
215
+ _ <- waitForDiagnostics
202
216
compls <- getCompletions doc (Position 5 18 )
203
217
item <- getCompletionByLabel " filter" compls
204
218
liftIO $ do
@@ -213,6 +227,7 @@ snippetTests = testGroup "snippets" [
213
227
let te = TextEdit (Range (Position 5 7 ) (Position 5 24 )) " even `filte`"
214
228
_ <- applyEdit doc te
215
229
230
+ _ <- waitForDiagnostics
216
231
compls <- getCompletions doc (Position 5 18 )
217
232
item <- getCompletionByLabel " filter" compls
218
233
liftIO $ do
@@ -227,6 +242,7 @@ snippetTests = testGroup "snippets" [
227
242
let te = TextEdit (Range (Position 5 7 ) (Position 5 24 )) " \"\" `Data.List.interspe"
228
243
_ <- applyEdit doc te
229
244
245
+ _ <- waitForDiagnostics
230
246
compls <- getCompletions doc (Position 5 29 )
231
247
item <- getCompletionByLabel " intersperse" compls
232
248
liftIO $ do
@@ -241,6 +257,7 @@ snippetTests = testGroup "snippets" [
241
257
let te = TextEdit (Range (Position 5 7 ) (Position 5 24 )) " \"\" `Data.List.interspe`"
242
258
_ <- applyEdit doc te
243
259
260
+ _ <- waitForDiagnostics
244
261
compls <- getCompletions doc (Position 5 29 )
245
262
item <- getCompletionByLabel " intersperse" compls
246
263
liftIO $ do
@@ -268,6 +285,7 @@ snippetTests = testGroup "snippets" [
268
285
let te = TextEdit (Range (Position 1 0 ) (Position 1 2 )) " MkF"
269
286
_ <- applyEdit doc te
270
287
288
+ _ <- waitForDiagnostics
271
289
compls <- getCompletions doc (Position 1 6 )
272
290
item <- case find (\ c -> (c ^. label == " MkFoo" ) && maybe False (" MkFoo {" `T.isPrefixOf` ) (c ^. insertText)) compls of
273
291
Just c -> pure c
@@ -281,6 +299,7 @@ snippetTests = testGroup "snippets" [
281
299
let te = TextEdit (Range (Position 5 7 ) (Position 5 24 )) " fold"
282
300
_ <- applyEdit doc te
283
301
302
+ _ <- waitForDiagnostics
284
303
compls <- getCompletions doc (Position 5 11 )
285
304
item <- getCompletionByLabel " foldl" compls
286
305
liftIO $ do
@@ -306,6 +325,7 @@ contextTests = testGroup "contexts" [
306
325
testCase " only provides type suggestions" $ runSession hlsCommand fullCaps " test/testdata/completion" $ do
307
326
doc <- openDoc " Context.hs" " haskell"
308
327
328
+ _ <- waitForDiagnostics
309
329
compls <- getCompletions doc (Position 2 17 )
310
330
liftIO $ do
311
331
compls `shouldContainCompl` " Integer"
@@ -314,6 +334,7 @@ contextTests = testGroup "contexts" [
314
334
, testCase " only provides value suggestions" $ runSession hlsCommand fullCaps " test/testdata/completion" $ do
315
335
doc <- openDoc " Context.hs" " haskell"
316
336
337
+ _ <- waitForDiagnostics
317
338
compls <- getCompletions doc (Position 3 10 )
318
339
liftIO $ do
319
340
compls `shouldContainCompl` " abs"
@@ -322,6 +343,7 @@ contextTests = testGroup "contexts" [
322
343
, testCase " completes qualified type suggestions" $ runSession hlsCommand fullCaps " test/testdata/completion" $ do
323
344
doc <- openDoc " Context.hs" " haskell"
324
345
346
+ _ <- waitForDiagnostics
325
347
compls <- getCompletions doc (Position 2 26 )
326
348
liftIO $ do
327
349
compls `shouldNotContainCompl` " forkOn"
0 commit comments