feat(completion): mark deprecated symbols with strikethrough (#414)
## Summary - Check `CXAvailability_Deprecated` on `CodeCompletionResult` and set `CompletionItemTag::Deprecated` - Editors render deprecated completions with a strikethrough on the label ## Test plan - [x] `DeprecatedTag` — `[[deprecated]]` function gets the tag - [x] `NotDeprecated` — normal function has no Deprecated tag - [x] All 491 unit tests pass - [x] `pixi run format` clean Stacked on #411. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Code completion now marks deprecated declarations with a deprecated tag so users can see deprecated items in completion lists. * **Tests** * Added unit tests ensuring deprecated declarations produce completion items with the deprecated tag and non-deprecated items do not. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -233,6 +233,33 @@ void bar() {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(DeprecatedTag) {
|
||||
code_complete(R"cpp(
|
||||
[[deprecated]] int foooo(int x);
|
||||
int z = fo$(pos)
|
||||
)cpp");
|
||||
|
||||
auto it = find_item("foooo");
|
||||
ASSERT_TRUE(it != items.end());
|
||||
ASSERT_TRUE(it->tags.has_value());
|
||||
auto& tags = *it->tags;
|
||||
ASSERT_TRUE(std::ranges::find(tags, protocol::CompletionItemTag::Deprecated) != tags.end());
|
||||
}
|
||||
|
||||
TEST_CASE(NotDeprecated) {
|
||||
code_complete(R"cpp(
|
||||
int foooo(int x);
|
||||
int z = fo$(pos)
|
||||
)cpp");
|
||||
|
||||
auto it = find_item("foooo");
|
||||
ASSERT_TRUE(it != items.end());
|
||||
// Non-deprecated should have no Deprecated tag.
|
||||
ASSERT_TRUE(!it->tags.has_value() ||
|
||||
std::ranges::find(*it->tags, protocol::CompletionItemTag::Deprecated) ==
|
||||
it->tags->end());
|
||||
}
|
||||
|
||||
TEST_CASE(NoBundleOverloads) {
|
||||
feature::CodeCompletionOptions opts;
|
||||
opts.bundle_overloads = false;
|
||||
|
||||
Reference in New Issue
Block a user