Commit 9e75ff8e authored by Christian Kamm's avatar Christian Kamm
Browse files

Don't add the default arguments when completing function definitions.

Fixes QTCREATORBUG-787

Reviewed-by: Erik Verbruggen
parent d700b847
......@@ -41,7 +41,8 @@ Overview::Overview()
_showArgumentNames(false),
_showReturnTypes(false),
_showFunctionSignatures(true),
_showFullyQualifiedNames(false)
_showFullyQualifiedNames(false),
_showDefaultArguments(true)
{ }
Overview::~Overview()
......@@ -117,6 +118,16 @@ void Overview::setShowFullyQualifiedNamed(bool showFullyQualifiedNames)
_showFullyQualifiedNames = showFullyQualifiedNames;
}
bool Overview::showDefaultArguments() const
{
return _showDefaultArguments;
}
void Overview::setShowDefaultArguments(bool showDefaultArguments)
{
_showDefaultArguments = showDefaultArguments;
}
QString Overview::prettyName(const Name *name) const
{
NamePrettyPrinter pp(this);
......
......@@ -56,6 +56,9 @@ public:
bool showFullyQualifiedNames() const;
void setShowFullyQualifiedNamed(bool showFullyQualifiedNames);
bool showDefaultArguments() const;
void setShowDefaultArguments(bool showDefaultArguments);
// argument index that you want to mark
unsigned markedArgument() const;
void setMarkedArgument(unsigned position);
......@@ -84,6 +87,7 @@ private:
bool _showReturnTypes: 1;
bool _showFunctionSignatures: 1;
bool _showFullyQualifiedNames: 1;
bool _showDefaultArguments: 1;
};
} // end of namespace CPlusPlus
......
......@@ -340,9 +340,11 @@ void TypePrettyPrinter::visit(Function *type)
_text += argumentText(arg->type(), name);
if (const StringLiteral *initializer = arg->initializer()) {
_text += QLatin1String(" =");
_text += QString::fromUtf8(initializer->chars(), initializer->size());
if (_overview->showDefaultArguments()) {
if (const StringLiteral *initializer = arg->initializer()) {
_text += QLatin1String(" =");
_text += QString::fromUtf8(initializer->chars(), initializer->size());
}
}
if (index + 1 == _overview->markedArgument())
......
......@@ -1096,6 +1096,7 @@ bool CppCodeCompletion::completeConstructorOrFunction(const QList<LookupItem> &r
foreach (Function *f, functions) {
Overview overview;
overview.setShowArgumentNames(true);
overview.setShowDefaultArguments(false);
// gets: "parameter list) cv-spec",
QString completion = overview(f->type()).mid(1);
......
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