Commit 5df80855 authored by Marco Bubke's avatar Marco Bubke
Browse files

Clang: Remove the hint and snippet field from the CodeCompletion



It is not used and is producing overhead.

Change-Id: I1398b18a40c0f5c0b90fe4c058996d7eb109f9f2
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@theqtcompany.com>
parent 33650194
......@@ -38,15 +38,11 @@
namespace ClangBackEnd {
CodeCompletion::CodeCompletion(const Utf8String &text,
const Utf8String &hint,
const Utf8String &snippet,
quint32 priority,
Kind completionKind,
Availability availability,
bool hasParameters)
: text_(text),
hint_(hint),
snippet_(snippet),
priority_(priority),
completionKind_(completionKind),
availability_(availability),
......@@ -63,15 +59,6 @@ const Utf8String &CodeCompletion::text() const
{
return text_;
}
const Utf8String &CodeCompletion::hint() const
{
return hint_;
}
const Utf8String &CodeCompletion::snippet() const
{
return snippet_;
}
void CodeCompletion::setCompletionKind(CodeCompletion::Kind completionKind)
{
......@@ -136,8 +123,6 @@ quint32 &CodeCompletion::availabilityAsInt()
QDataStream &operator<<(QDataStream &out, const CodeCompletion &command)
{
out << command.text_;
out << command.hint_;
out << command.snippet_;
out << command.chunks_;
out << command.priority_;
out << command.completionKind_;
......@@ -150,8 +135,6 @@ QDataStream &operator<<(QDataStream &out, const CodeCompletion &command)
QDataStream &operator>>(QDataStream &in, CodeCompletion &command)
{
in >> command.text_;
in >> command.hint_;
in >> command.snippet_;
in >> command.chunks_;
in >> command.priority_;
in >> command.completionKindAsInt();
......@@ -213,8 +196,6 @@ QDebug operator<<(QDebug debug, const CodeCompletion &command)
debug.nospace() << "CodeCompletion(";
debug.nospace() << command.text_ << ", ";
debug.nospace() << command.hint_ << ", ";
debug.nospace() << command.snippet_ << ", ";
debug.nospace() << command.priority_ << ", ";
debug.nospace() << completionKindToString(command.completionKind_) << ", ";
debug.nospace() << availabilityToString(command.availability_) << ", ";
......@@ -230,8 +211,6 @@ void PrintTo(const CodeCompletion &command, ::std::ostream* os)
*os << "CodeCompletion(";
*os << command.text_.constData() << ", ";
*os << command.hint_.constData() << ", ";
*os << command.snippet_.constData() << ", ";
*os << command.priority_ << ", ";
*os << completionKindToString(command.completionKind_) << ", ";
*os << availabilityToString(command.availability_) << ", ";
......
......@@ -80,8 +80,6 @@ public:
public:
CodeCompletion() = default;
CodeCompletion(const Utf8String &text,
const Utf8String &hint = Utf8String(),
const Utf8String &snippet = Utf8String(),
quint32 priority = 0,
Kind completionKind = Other,
Availability availability = Available,
......@@ -90,9 +88,6 @@ public:
void setText(const Utf8String &text);
const Utf8String &text() const;
const Utf8String &hint() const;
const Utf8String &snippet() const;
void setCompletionKind(Kind completionKind);
Kind completionKind() const;
......@@ -114,8 +109,6 @@ private:
private:
Utf8String text_;
Utf8String hint_;
Utf8String snippet_;
QVector<CodeCompletionChunk> chunks_;
quint32 priority_ = 0;
Kind completionKind_ = Other;
......
......@@ -149,8 +149,6 @@ TEST_F(ClangIpcServer, GetCodeCompletion)
1,
projectPartId);
CodeCompletion codeCompletion(Utf8StringLiteral("Function"),
Utf8String(),
Utf8String(),
34,
CodeCompletion::FunctionCompletionKind);
......@@ -167,8 +165,6 @@ TEST_F(ClangIpcServer, GetCodeCompletionDependingOnArgumets)
1,
projectPartId);
CodeCompletion codeCompletion(Utf8StringLiteral("ArgumentDefinitionVariable"),
Utf8String(),
Utf8String(),
34,
CodeCompletion::VariableCompletionKind);
......@@ -214,8 +210,6 @@ TEST_F(ClangIpcServer, GetCodeCompletionForUnsavedFile)
1,
projectPartId);
CodeCompletion codeCompletion(Utf8StringLiteral("Method2"),
Utf8String(),
Utf8String(),
34,
CodeCompletion::FunctionCompletionKind);
......@@ -233,8 +227,6 @@ TEST_F(ClangIpcServer, GetNoCodeCompletionAfterRemovingUnsavedFile)
1,
projectPartId);
CodeCompletion codeCompletion(Utf8StringLiteral("Method2"),
Utf8String(),
Utf8String(),
34,
CodeCompletion::FunctionCompletionKind);
......@@ -255,8 +247,6 @@ TEST_F(ClangIpcServer, GetNewCodeCompletionAfterUpdatingUnsavedFile)
1,
projectPartId);
CodeCompletion codeCompletion(Utf8StringLiteral("Method3"),
Utf8String(),
Utf8String(),
34,
CodeCompletion::FunctionCompletionKind);
......@@ -367,8 +357,6 @@ TEST_F(ClangIpcServer, TicketNumberIsForwarded)
1,
projectPartId);
CodeCompletion codeCompletion(Utf8StringLiteral("Function"),
Utf8String(),
Utf8String(),
34,
CodeCompletion::FunctionCompletionKind);
......
......@@ -95,28 +95,18 @@ TEST_F(CodeCompleter, FunctionInUnsavedFile)
{
ASSERT_THAT(completer.complete(100, 1),
AllOf(Contains(CodeCompletion(Utf8StringLiteral("functionWithArguments"),
Utf8String(),
Utf8String(),
0,
CodeCompletion::FunctionCompletionKind)),
Contains(CodeCompletion(Utf8StringLiteral("function"),
Utf8String(),
Utf8String(),
0,
CodeCompletion::FunctionCompletionKind)),
Contains(CodeCompletion(Utf8StringLiteral("newFunction"),
Utf8String(),
Utf8String(),
0,
CodeCompletion::FunctionCompletionKind)),
Contains(CodeCompletion(Utf8StringLiteral("f"),
Utf8String(),
Utf8String(),
0,
CodeCompletion::FunctionCompletionKind)),
Not(Contains(CodeCompletion(Utf8StringLiteral("otherFunction"),
Utf8String(),
Utf8String(),
0,
CodeCompletion::FunctionCompletionKind)))));
}
......@@ -126,8 +116,6 @@ TEST_F(CodeCompleter, Macro)
{
ASSERT_THAT(completer.complete(100, 1),
Contains(CodeCompletion(Utf8StringLiteral("Macro"),
Utf8String(),
Utf8String(),
0,
CodeCompletion::PreProcessorCompletionKind)));
}
......@@ -136,8 +124,6 @@ TEST_F(CodeCompleter, Keyword)
{
ASSERT_THAT(completer.complete(100, 1),
Contains(CodeCompletion(Utf8StringLiteral("switch"),
Utf8String(),
Utf8String(),
0,
CodeCompletion::KeywordCompletionKind)));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment