@@ -142,7 +142,7 @@ async fn test_completion_interface_constant_via_double_colon() {
142142// ─── Basic Completion Tests ─────────────────────────────────────────────────
143143
144144#[ tokio:: test]
145- async fn test_completion_returns_phpantomlsp ( ) {
145+ async fn test_completion_returns_none_when_nothing_matches ( ) {
146146 let backend = create_test_backend ( ) ;
147147
148148 let uri = Url :: parse ( "file:///test.php" ) . unwrap ( ) ;
@@ -172,15 +172,10 @@ async fn test_completion_returns_phpantomlsp() {
172172 } ;
173173
174174 let result = backend. completion ( completion_params) . await . unwrap ( ) ;
175- assert ! ( result. is_some( ) , "Completion should return results" ) ;
176-
177- match result. unwrap ( ) {
178- CompletionResponse :: Array ( items) => {
179- assert ! ( !items. is_empty( ) , "Should have at least one item" ) ;
180- assert_eq ! ( items[ 0 ] . label, "PHPantomLSP" ) ;
181- }
182- _ => panic ! ( "Expected CompletionResponse::Array" ) ,
183- }
175+ assert ! (
176+ result. is_none( ) ,
177+ "Completion should return None when nothing matches"
178+ ) ;
184179}
185180
186181#[ tokio:: test]
@@ -306,15 +301,10 @@ async fn test_completion_outside_class_returns_fallback() {
306301 } ;
307302
308303 let result = backend. completion ( completion_params) . await . unwrap ( ) ;
309- assert ! ( result. is_some( ) ) ;
310-
311- match result. unwrap ( ) {
312- CompletionResponse :: Array ( items) => {
313- assert_eq ! ( items. len( ) , 1 , "Should fall back to default item" ) ;
314- assert_eq ! ( items[ 0 ] . label, "PHPantomLSP" ) ;
315- }
316- _ => panic ! ( "Expected CompletionResponse::Array" ) ,
317- }
304+ assert ! (
305+ result. is_none( ) ,
306+ "Cursor outside class with no operator should return None"
307+ ) ;
318308}
319309
320310#[ tokio:: test]
@@ -421,16 +411,11 @@ async fn test_completion_empty_class_falls_back() {
421411 } ;
422412
423413 let result = backend. completion ( completion_params) . await . unwrap ( ) ;
424- assert ! ( result. is_some( ) ) ;
425-
426- // Empty class has no methods or properties, so should fall back to PHPantomLSP
427- match result. unwrap ( ) {
428- CompletionResponse :: Array ( items) => {
429- assert_eq ! ( items. len( ) , 1 ) ;
430- assert_eq ! ( items[ 0 ] . label, "PHPantomLSP" ) ;
431- }
432- _ => panic ! ( "Expected CompletionResponse::Array" ) ,
433- }
414+ // Empty class has no methods or properties, so should return None
415+ assert ! (
416+ result. is_none( ) ,
417+ "Empty class with no members should return None"
418+ ) ;
434419}
435420
436421#[ tokio:: test]
@@ -475,14 +460,6 @@ async fn test_completion_no_access_operator_shows_fallback() {
475460 } ;
476461
477462 let result = backend. completion ( completion_params) . await . unwrap ( ) ;
478- assert ! ( result. is_some( ) , "Completion should return fallback" ) ;
479-
480- // Without `->` or `::`, no class members should be suggested — only fallback
481- match result. unwrap ( ) {
482- CompletionResponse :: Array ( items) => {
483- assert_eq ! ( items. len( ) , 1 , "Should only have fallback item" ) ;
484- assert_eq ! ( items[ 0 ] . label, "PHPantomLSP" ) ;
485- }
486- _ => panic ! ( "Expected CompletionResponse::Array" ) ,
487- }
463+ // Without `->` or `::`, no class members should be suggested
464+ assert ! ( result. is_none( ) , "No access operator should return None" ) ;
488465}
0 commit comments