Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 113deb25 authored by Milian Wolff's avatar Milian Wolff

Workaround: find declarations for constructor argument hints

Summary:
For non-namespaced constructors we can find the declarations by
manually adding the identifier a second time before the lookup,
as that gives us the proper QID. This allows us to find the
declaration for many situations, most notably for most Qt classes.

Subscribers: kdevelop-devel

Differential Revision: https://phabricator.kde.org/D9745
parent 67b8f6c2
......@@ -1101,6 +1101,12 @@ QList<CompletionTreeItemPointer> ClangCodeCompletionContext::completionItems(boo
continue;
}
if (isOverloadCandidate && resultType.isEmpty() && parent.isEmpty()) {
// workaround: find constructor calls for non-namespaced classes
// TODO: return the namespaced class as parent in libclang
qid.push(id);
}
auto found = findDeclaration(qid, ctx, m_position, isOverloadCandidate ? overloadsHandled : handled);
CompletionTreeItemPointer item;
......
......@@ -1172,7 +1172,6 @@ void TestCodeCompletion::testArgumentHintCompletion()
std::sort(actualHints.begin(), actualHints.end());
QEXPECT_FAIL("member function", "clang_getCompletionParent returns nothing, thus decl lookup fails", Continue);
QEXPECT_FAIL("namespaced function", "clang_getCompletionParent returns nothing, thus decl lookup fails", Continue);
QEXPECT_FAIL("constructor", "clang_getCompletionParent returns nothing, thus decl lookup fails", Continue);
QEXPECT_FAIL("namespaced constructor", "clang_getCompletionParent returns nothing, thus decl lookup fails", Continue);
QCOMPARE(actualHints, hints);
});
......
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