ClangCodeModel: Special rendering for deprecated completion items

We add the attribute textually and show a warning icon.

Fixes: QTCREATORBUG-2325
Change-Id: Icc0305a703e26c84095167087b30fa3456f97614
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-06-17 09:48:54 +02:00
parent 79b8e5397d
commit 0fa349237d
6 changed files with 53 additions and 0 deletions

View File

@@ -227,6 +227,15 @@ bool LanguageClientCompletionItem::isPerfectMatch(int pos, QTextDocument *doc) c
return textToInsert == textAt(QTextCursor(doc), pos - length, length);
}
bool LanguageClientCompletionItem::isDeprecated() const
{
if (const auto tags = m_item.tags(); tags && tags->contains(CompletionItem::Deprecated))
return true;
if (const auto deprecated = m_item.deprecated())
return *deprecated;
return false;
}
class LanguageClientCompletionModel : public GenericProposalModel
{
public: