Commit 815d9cb1 authored by Christian Kamm's avatar Christian Kamm

C++ completion: Minimize qualified names in function signatures.

Change-Id: I8e2c38e279952372b3e12f6ea8da18b75b39a5d4
Reviewed-on: default avatarLeandro T. C. Melo <>
parent 6fe8d74a
......@@ -47,6 +47,7 @@
#include <SymbolVisitor.h>
#include <Scope.h>
#include <TranslationUnit.h>
#include <CppRewriter.h>
#include <cplusplus/ResolveExpression.h>
#include <cplusplus/MatchingText.h>
......@@ -1857,14 +1858,29 @@ bool CppCompletionAssistProcessor::completeConstructorOrFunction(const QList<CPl
if (autocompleteSignature && !isDestructor) {
// set up for rewriting function types with minimally qualified names
// to do it correctly we'd need the declaration's context and scope, but
// that'd be too expensive to get here. instead, we just minimize locally
SubstitutionEnvironment env;
ClassOrNamespace *targetCoN = context.lookupType(sc);
if (!targetCoN)
targetCoN = context.globalNamespace();
UseMinimalNames q(targetCoN);
Control *control = context.control().data();
// set up signature autocompletion
foreach (Function *f, functions) {
Overview overview;
const FullySpecifiedType localTy = rewriteType(f->type(), &env, control);
// gets: "parameter list) cv-spec",
QString completion = overview(f->type()).mid(1);
QString completion = overview(localTy).mid(1);
addCompletionItem(completion, QIcon(), 0,
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