MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / completions_bare_at_class

Function completions_bare_at_class

tests/unit/phpdoc_internals.rs:1436–1484  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1434
1435#[test]
1436fn completions_bare_at_class() {
1437 let content = "<?php\n/**\n * @\n */\nclass Foo {}\n";
1438 let pos = Position {
1439 line: 2,
1440 character: 4,
1441 };
1442 let items = build_phpdoc_completions(
1443 content,
1444 "@",
1445 DocblockContext::ClassLike,
1446 pos,
1447 &std::collections::HashMap::new(),
1448 &None,
1449 &SmartContext::EMPTY,
1450 );
1451 let filter_texts: Vec<&str> = items
1452 .iter()
1453 .filter_map(|i| i.filter_text.as_deref())
1454 .collect();
1455
1456 assert!(
1457 filter_texts.contains(&"@property"),
1458 "Should suggest @property"
1459 );
1460 assert!(filter_texts.contains(&"@method"), "Should suggest @method");
1461 assert!(filter_texts.contains(&"@mixin"), "Should suggest @mixin");
1462 assert!(
1463 filter_texts.contains(&"@template"),
1464 "Should suggest @template"
1465 );
1466 assert!(
1467 filter_texts.contains(&"@deprecated"),
1468 "Should suggest @deprecated"
1469 );
1470
1471 // Should NOT suggest function-only tags
1472 assert!(
1473 !filter_texts.contains(&"@param"),
1474 "Should NOT suggest @param in class context"
1475 );
1476 assert!(
1477 !filter_texts.contains(&"@return"),
1478 "Should NOT suggest @return in class context"
1479 );
1480 assert!(
1481 !filter_texts.contains(&"@throws"),
1482 "Should NOT suggest @throws in class context"
1483 );
1484}
1485
1486#[test]
1487fn completions_bare_at_property() {

Callers

nothing calls this directly

Calls 2

build_phpdoc_completionsFunction · 0.85
iterMethod · 0.80

Tested by

no test coverage detected