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

Function completions_phpstan_prefix

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

Source from the content-addressed store, hash-verified

1642
1643#[test]
1644fn completions_phpstan_prefix() {
1645 let content = "<?php\n/**\n * @phpstan-a\n */\nfunction foo(): void {}\n";
1646 let pos = Position {
1647 line: 2,
1648 character: 14,
1649 };
1650 let items = build_phpdoc_completions(
1651 content,
1652 "@phpstan-a",
1653 DocblockContext::FunctionOrMethod,
1654 pos,
1655 &std::collections::HashMap::new(),
1656 &None,
1657 &SmartContext::EMPTY,
1658 );
1659 let filter_texts: Vec<&str> = items
1660 .iter()
1661 .filter_map(|i| i.filter_text.as_deref())
1662 .collect();
1663
1664 assert!(
1665 filter_texts.contains(&"@phpstan-assert"),
1666 "Should suggest @phpstan-assert"
1667 );
1668 assert!(
1669 filter_texts.contains(&"@phpstan-assert-if-true"),
1670 "Should suggest @phpstan-assert-if-true"
1671 );
1672 assert!(
1673 filter_texts.contains(&"@phpstan-assert-if-false"),
1674 "Should suggest @phpstan-assert-if-false"
1675 );
1676 assert!(
1677 !filter_texts.contains(&"@phpstan-self-out"),
1678 "Should NOT suggest @phpstan-self-out for prefix @phpstan-a"
1679 );
1680}
1681
1682#[test]
1683fn completions_case_insensitive() {

Callers

nothing calls this directly

Calls 2

build_phpdoc_completionsFunction · 0.85
iterMethod · 0.80

Tested by

no test coverage detected