@@ -193,6 +193,44 @@ public function testHandleSuggestionsWithSnippetsWhenClientDoesNotSupportIt()
193193 $ this ->assertFalse ($ response ->result ->isIncomplete );
194194 }
195195
196+ public function testHandleSuggestionsWithProiority (): void
197+ {
198+ $ tester = $ this ->create ([
199+ Suggestion::createWithOptions ('hello ' , [
200+ 'type ' => Suggestion::TYPE_METHOD ,
201+ 'label ' => 'hello ' ,
202+ 'priority ' => Suggestion::PRIORITY_HIGH
203+ ]),
204+ Suggestion::createWithOptions ('goodbye ' , [
205+ 'type ' => Suggestion::TYPE_METHOD ,
206+ 'snippet ' => 'goodbye() ' ,
207+ 'priority ' => Suggestion::PRIORITY_LOW
208+ ]),
209+ Suggestion::createWithOptions ('$var ' , [
210+ 'type ' => Suggestion::TYPE_VARIABLE ,
211+ ]),
212+ ], false );
213+
214+ $ response = $ tester ->requestAndWait (
215+ 'textDocument/completion ' ,
216+ [
217+ 'textDocument ' => ProtocolFactory::textDocumentIdentifier (self ::EXAMPLE_URI ),
218+ 'position ' => ProtocolFactory::position (0 , 0 )
219+ ]
220+ );
221+
222+ $ this ->assertEquals ([
223+ self ::completionItem ('hello ' , 2 , [
224+ 'sortText ' => '0064-hello ' ,
225+ ]),
226+ self ::completionItem ('goodbye ' , 2 , [
227+ 'sortText ' => '0255-goodbye ' ,
228+ ]),
229+ self ::completionItem ('var ' , 6 ),
230+ ], $ response ->result ->items );
231+ $ this ->assertFalse ($ response ->result ->isIncomplete );
232+ }
233+
196234 private static function completionItem (
197235 string $ label ,
198236 ?int $ type ,
0 commit comments