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

Function completions_bare_at_constant

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

Source from the content-addressed store, hash-verified

1533
1534#[test]
1535fn completions_bare_at_constant() {
1536 let content = concat!(
1537 "<?php\nclass Foo {\n",
1538 " /**\n",
1539 " * @\n",
1540 " */\n",
1541 " const X = 1;\n",
1542 "}\n",
1543 );
1544 let pos = Position {
1545 line: 3,
1546 character: 8,
1547 };
1548 let items = build_phpdoc_completions(
1549 content,
1550 "@",
1551 DocblockContext::Constant,
1552 pos,
1553 &std::collections::HashMap::new(),
1554 &None,
1555 &SmartContext::EMPTY,
1556 );
1557 let filter_texts: Vec<&str> = items
1558 .iter()
1559 .filter_map(|i| i.filter_text.as_deref())
1560 .collect();
1561
1562 assert!(filter_texts.contains(&"@var"), "Should suggest @var");
1563 assert!(
1564 filter_texts.contains(&"@deprecated"),
1565 "Should suggest @deprecated"
1566 );
1567
1568 assert!(
1569 !filter_texts.contains(&"@param"),
1570 "Should NOT suggest @param in constant context"
1571 );
1572}
1573
1574#[test]
1575fn completions_unknown_includes_all() {

Callers

nothing calls this directly

Calls 2

build_phpdoc_completionsFunction · 0.85
iterMethod · 0.80

Tested by

no test coverage detected