forked from qt-creator/qt-creator
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:
@@ -741,6 +741,7 @@ public:
|
||||
|
||||
private:
|
||||
QIcon icon() const override;
|
||||
QString text() const override;
|
||||
};
|
||||
|
||||
class ClangdClient::ClangdCompletionAssistProcessor : public LanguageClientCompletionAssistProcessor
|
||||
@@ -2551,6 +2552,8 @@ ClangdCompletionItem::SpecialQtType ClangdCompletionItem::getQtType(const Comple
|
||||
|
||||
QIcon ClangdCompletionItem::icon() const
|
||||
{
|
||||
if (isDeprecated())
|
||||
return Utils::Icons::WARNING.icon();
|
||||
const SpecialQtType qtType = getQtType(item());
|
||||
switch (qtType) {
|
||||
case SpecialQtType::Signal:
|
||||
@@ -2566,6 +2569,14 @@ QIcon ClangdCompletionItem::icon() const
|
||||
return LanguageClientCompletionItem::icon();
|
||||
}
|
||||
|
||||
QString ClangdCompletionItem::text() const
|
||||
{
|
||||
const QString clangdValue = LanguageClientCompletionItem::text();
|
||||
if (isDeprecated())
|
||||
return "[[deprecated]]" + clangdValue;
|
||||
return clangdValue;
|
||||
}
|
||||
|
||||
MessageId ClangdClient::Private::getAndHandleAst(const TextDocOrFile &doc,
|
||||
const AstHandler &astHandler,
|
||||
AstCallbackMode callbackMode, const Range &range)
|
||||
|
||||
Reference in New Issue
Block a user