forked from qt-creator/qt-creator
Clang: Remove the hint and snippet field from the CodeCompletion
It is not used and is producing overhead. Change-Id: I1398b18a40c0f5c0b90fe4c058996d7eb109f9f2 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
@@ -38,15 +38,11 @@
|
|||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
CodeCompletion::CodeCompletion(const Utf8String &text,
|
CodeCompletion::CodeCompletion(const Utf8String &text,
|
||||||
const Utf8String &hint,
|
|
||||||
const Utf8String &snippet,
|
|
||||||
quint32 priority,
|
quint32 priority,
|
||||||
Kind completionKind,
|
Kind completionKind,
|
||||||
Availability availability,
|
Availability availability,
|
||||||
bool hasParameters)
|
bool hasParameters)
|
||||||
: text_(text),
|
: text_(text),
|
||||||
hint_(hint),
|
|
||||||
snippet_(snippet),
|
|
||||||
priority_(priority),
|
priority_(priority),
|
||||||
completionKind_(completionKind),
|
completionKind_(completionKind),
|
||||||
availability_(availability),
|
availability_(availability),
|
||||||
@@ -63,15 +59,6 @@ const Utf8String &CodeCompletion::text() const
|
|||||||
{
|
{
|
||||||
return text_;
|
return text_;
|
||||||
}
|
}
|
||||||
const Utf8String &CodeCompletion::hint() const
|
|
||||||
{
|
|
||||||
return hint_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Utf8String &CodeCompletion::snippet() const
|
|
||||||
{
|
|
||||||
return snippet_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CodeCompletion::setCompletionKind(CodeCompletion::Kind completionKind)
|
void CodeCompletion::setCompletionKind(CodeCompletion::Kind completionKind)
|
||||||
{
|
{
|
||||||
@@ -136,8 +123,6 @@ quint32 &CodeCompletion::availabilityAsInt()
|
|||||||
QDataStream &operator<<(QDataStream &out, const CodeCompletion &command)
|
QDataStream &operator<<(QDataStream &out, const CodeCompletion &command)
|
||||||
{
|
{
|
||||||
out << command.text_;
|
out << command.text_;
|
||||||
out << command.hint_;
|
|
||||||
out << command.snippet_;
|
|
||||||
out << command.chunks_;
|
out << command.chunks_;
|
||||||
out << command.priority_;
|
out << command.priority_;
|
||||||
out << command.completionKind_;
|
out << command.completionKind_;
|
||||||
@@ -150,8 +135,6 @@ QDataStream &operator<<(QDataStream &out, const CodeCompletion &command)
|
|||||||
QDataStream &operator>>(QDataStream &in, CodeCompletion &command)
|
QDataStream &operator>>(QDataStream &in, CodeCompletion &command)
|
||||||
{
|
{
|
||||||
in >> command.text_;
|
in >> command.text_;
|
||||||
in >> command.hint_;
|
|
||||||
in >> command.snippet_;
|
|
||||||
in >> command.chunks_;
|
in >> command.chunks_;
|
||||||
in >> command.priority_;
|
in >> command.priority_;
|
||||||
in >> command.completionKindAsInt();
|
in >> command.completionKindAsInt();
|
||||||
@@ -213,8 +196,6 @@ QDebug operator<<(QDebug debug, const CodeCompletion &command)
|
|||||||
debug.nospace() << "CodeCompletion(";
|
debug.nospace() << "CodeCompletion(";
|
||||||
|
|
||||||
debug.nospace() << command.text_ << ", ";
|
debug.nospace() << command.text_ << ", ";
|
||||||
debug.nospace() << command.hint_ << ", ";
|
|
||||||
debug.nospace() << command.snippet_ << ", ";
|
|
||||||
debug.nospace() << command.priority_ << ", ";
|
debug.nospace() << command.priority_ << ", ";
|
||||||
debug.nospace() << completionKindToString(command.completionKind_) << ", ";
|
debug.nospace() << completionKindToString(command.completionKind_) << ", ";
|
||||||
debug.nospace() << availabilityToString(command.availability_) << ", ";
|
debug.nospace() << availabilityToString(command.availability_) << ", ";
|
||||||
@@ -230,8 +211,6 @@ void PrintTo(const CodeCompletion &command, ::std::ostream* os)
|
|||||||
*os << "CodeCompletion(";
|
*os << "CodeCompletion(";
|
||||||
|
|
||||||
*os << command.text_.constData() << ", ";
|
*os << command.text_.constData() << ", ";
|
||||||
*os << command.hint_.constData() << ", ";
|
|
||||||
*os << command.snippet_.constData() << ", ";
|
|
||||||
*os << command.priority_ << ", ";
|
*os << command.priority_ << ", ";
|
||||||
*os << completionKindToString(command.completionKind_) << ", ";
|
*os << completionKindToString(command.completionKind_) << ", ";
|
||||||
*os << availabilityToString(command.availability_) << ", ";
|
*os << availabilityToString(command.availability_) << ", ";
|
||||||
|
|||||||
@@ -80,8 +80,6 @@ public:
|
|||||||
public:
|
public:
|
||||||
CodeCompletion() = default;
|
CodeCompletion() = default;
|
||||||
CodeCompletion(const Utf8String &text,
|
CodeCompletion(const Utf8String &text,
|
||||||
const Utf8String &hint = Utf8String(),
|
|
||||||
const Utf8String &snippet = Utf8String(),
|
|
||||||
quint32 priority = 0,
|
quint32 priority = 0,
|
||||||
Kind completionKind = Other,
|
Kind completionKind = Other,
|
||||||
Availability availability = Available,
|
Availability availability = Available,
|
||||||
@@ -90,9 +88,6 @@ public:
|
|||||||
void setText(const Utf8String &text);
|
void setText(const Utf8String &text);
|
||||||
const Utf8String &text() const;
|
const Utf8String &text() const;
|
||||||
|
|
||||||
const Utf8String &hint() const;
|
|
||||||
const Utf8String &snippet() const;
|
|
||||||
|
|
||||||
void setCompletionKind(Kind completionKind);
|
void setCompletionKind(Kind completionKind);
|
||||||
Kind completionKind() const;
|
Kind completionKind() const;
|
||||||
|
|
||||||
@@ -114,8 +109,6 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Utf8String text_;
|
Utf8String text_;
|
||||||
Utf8String hint_;
|
|
||||||
Utf8String snippet_;
|
|
||||||
QVector<CodeCompletionChunk> chunks_;
|
QVector<CodeCompletionChunk> chunks_;
|
||||||
quint32 priority_ = 0;
|
quint32 priority_ = 0;
|
||||||
Kind completionKind_ = Other;
|
Kind completionKind_ = Other;
|
||||||
|
|||||||
@@ -149,8 +149,6 @@ TEST_F(ClangIpcServer, GetCodeCompletion)
|
|||||||
1,
|
1,
|
||||||
projectPartId);
|
projectPartId);
|
||||||
CodeCompletion codeCompletion(Utf8StringLiteral("Function"),
|
CodeCompletion codeCompletion(Utf8StringLiteral("Function"),
|
||||||
Utf8String(),
|
|
||||||
Utf8String(),
|
|
||||||
34,
|
34,
|
||||||
CodeCompletion::FunctionCompletionKind);
|
CodeCompletion::FunctionCompletionKind);
|
||||||
|
|
||||||
@@ -167,8 +165,6 @@ TEST_F(ClangIpcServer, GetCodeCompletionDependingOnArgumets)
|
|||||||
1,
|
1,
|
||||||
projectPartId);
|
projectPartId);
|
||||||
CodeCompletion codeCompletion(Utf8StringLiteral("ArgumentDefinitionVariable"),
|
CodeCompletion codeCompletion(Utf8StringLiteral("ArgumentDefinitionVariable"),
|
||||||
Utf8String(),
|
|
||||||
Utf8String(),
|
|
||||||
34,
|
34,
|
||||||
CodeCompletion::VariableCompletionKind);
|
CodeCompletion::VariableCompletionKind);
|
||||||
|
|
||||||
@@ -214,8 +210,6 @@ TEST_F(ClangIpcServer, GetCodeCompletionForUnsavedFile)
|
|||||||
1,
|
1,
|
||||||
projectPartId);
|
projectPartId);
|
||||||
CodeCompletion codeCompletion(Utf8StringLiteral("Method2"),
|
CodeCompletion codeCompletion(Utf8StringLiteral("Method2"),
|
||||||
Utf8String(),
|
|
||||||
Utf8String(),
|
|
||||||
34,
|
34,
|
||||||
CodeCompletion::FunctionCompletionKind);
|
CodeCompletion::FunctionCompletionKind);
|
||||||
|
|
||||||
@@ -233,8 +227,6 @@ TEST_F(ClangIpcServer, GetNoCodeCompletionAfterRemovingUnsavedFile)
|
|||||||
1,
|
1,
|
||||||
projectPartId);
|
projectPartId);
|
||||||
CodeCompletion codeCompletion(Utf8StringLiteral("Method2"),
|
CodeCompletion codeCompletion(Utf8StringLiteral("Method2"),
|
||||||
Utf8String(),
|
|
||||||
Utf8String(),
|
|
||||||
34,
|
34,
|
||||||
CodeCompletion::FunctionCompletionKind);
|
CodeCompletion::FunctionCompletionKind);
|
||||||
|
|
||||||
@@ -255,8 +247,6 @@ TEST_F(ClangIpcServer, GetNewCodeCompletionAfterUpdatingUnsavedFile)
|
|||||||
1,
|
1,
|
||||||
projectPartId);
|
projectPartId);
|
||||||
CodeCompletion codeCompletion(Utf8StringLiteral("Method3"),
|
CodeCompletion codeCompletion(Utf8StringLiteral("Method3"),
|
||||||
Utf8String(),
|
|
||||||
Utf8String(),
|
|
||||||
34,
|
34,
|
||||||
CodeCompletion::FunctionCompletionKind);
|
CodeCompletion::FunctionCompletionKind);
|
||||||
|
|
||||||
@@ -367,8 +357,6 @@ TEST_F(ClangIpcServer, TicketNumberIsForwarded)
|
|||||||
1,
|
1,
|
||||||
projectPartId);
|
projectPartId);
|
||||||
CodeCompletion codeCompletion(Utf8StringLiteral("Function"),
|
CodeCompletion codeCompletion(Utf8StringLiteral("Function"),
|
||||||
Utf8String(),
|
|
||||||
Utf8String(),
|
|
||||||
34,
|
34,
|
||||||
CodeCompletion::FunctionCompletionKind);
|
CodeCompletion::FunctionCompletionKind);
|
||||||
|
|
||||||
|
|||||||
@@ -95,28 +95,18 @@ TEST_F(CodeCompleter, FunctionInUnsavedFile)
|
|||||||
{
|
{
|
||||||
ASSERT_THAT(completer.complete(100, 1),
|
ASSERT_THAT(completer.complete(100, 1),
|
||||||
AllOf(Contains(CodeCompletion(Utf8StringLiteral("functionWithArguments"),
|
AllOf(Contains(CodeCompletion(Utf8StringLiteral("functionWithArguments"),
|
||||||
Utf8String(),
|
|
||||||
Utf8String(),
|
|
||||||
0,
|
0,
|
||||||
CodeCompletion::FunctionCompletionKind)),
|
CodeCompletion::FunctionCompletionKind)),
|
||||||
Contains(CodeCompletion(Utf8StringLiteral("function"),
|
Contains(CodeCompletion(Utf8StringLiteral("function"),
|
||||||
Utf8String(),
|
|
||||||
Utf8String(),
|
|
||||||
0,
|
0,
|
||||||
CodeCompletion::FunctionCompletionKind)),
|
CodeCompletion::FunctionCompletionKind)),
|
||||||
Contains(CodeCompletion(Utf8StringLiteral("newFunction"),
|
Contains(CodeCompletion(Utf8StringLiteral("newFunction"),
|
||||||
Utf8String(),
|
|
||||||
Utf8String(),
|
|
||||||
0,
|
0,
|
||||||
CodeCompletion::FunctionCompletionKind)),
|
CodeCompletion::FunctionCompletionKind)),
|
||||||
Contains(CodeCompletion(Utf8StringLiteral("f"),
|
Contains(CodeCompletion(Utf8StringLiteral("f"),
|
||||||
Utf8String(),
|
|
||||||
Utf8String(),
|
|
||||||
0,
|
0,
|
||||||
CodeCompletion::FunctionCompletionKind)),
|
CodeCompletion::FunctionCompletionKind)),
|
||||||
Not(Contains(CodeCompletion(Utf8StringLiteral("otherFunction"),
|
Not(Contains(CodeCompletion(Utf8StringLiteral("otherFunction"),
|
||||||
Utf8String(),
|
|
||||||
Utf8String(),
|
|
||||||
0,
|
0,
|
||||||
CodeCompletion::FunctionCompletionKind)))));
|
CodeCompletion::FunctionCompletionKind)))));
|
||||||
}
|
}
|
||||||
@@ -126,8 +116,6 @@ TEST_F(CodeCompleter, Macro)
|
|||||||
{
|
{
|
||||||
ASSERT_THAT(completer.complete(100, 1),
|
ASSERT_THAT(completer.complete(100, 1),
|
||||||
Contains(CodeCompletion(Utf8StringLiteral("Macro"),
|
Contains(CodeCompletion(Utf8StringLiteral("Macro"),
|
||||||
Utf8String(),
|
|
||||||
Utf8String(),
|
|
||||||
0,
|
0,
|
||||||
CodeCompletion::PreProcessorCompletionKind)));
|
CodeCompletion::PreProcessorCompletionKind)));
|
||||||
}
|
}
|
||||||
@@ -136,8 +124,6 @@ TEST_F(CodeCompleter, Keyword)
|
|||||||
{
|
{
|
||||||
ASSERT_THAT(completer.complete(100, 1),
|
ASSERT_THAT(completer.complete(100, 1),
|
||||||
Contains(CodeCompletion(Utf8StringLiteral("switch"),
|
Contains(CodeCompletion(Utf8StringLiteral("switch"),
|
||||||
Utf8String(),
|
|
||||||
Utf8String(),
|
|
||||||
0,
|
0,
|
||||||
CodeCompletion::KeywordCompletionKind)));
|
CodeCompletion::KeywordCompletionKind)));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user