forked from qt-creator/qt-creator
ClangCodeModel: Relax completion result filtering
... in connect() calls.
The logic was: If we are in a place where a signal is expected and there
are signals among the completion results, then we should consider only
signals.
However, in e.g. a member function of a QObject subclass, there are
always signals in scope, even when we expect a class name. So we need to
allow class names as well.
Amends a79b0c6558.
Fixes: QTCREATORBUG-25153
Change-Id: Id3bbaaf4f8eefefe36cfc91e5959d3ef5ad28071
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -139,15 +139,17 @@ QList<AssistProposalItemInterface *> ClangCompletionAssistProcessor::toAssistPro
|
||||
considerOnlySignals = CppTools::CppModelManager::instance()
|
||||
->positionRequiresSignal(m_interface->filePath().toString(), m_content, m_position);
|
||||
}
|
||||
|
||||
for (const CodeCompletion &codeCompletion : completions) {
|
||||
if (considerOnlySignals && codeCompletion.completionKind
|
||||
!= CodeCompletion::SignalCompletionKind) {
|
||||
continue;
|
||||
}
|
||||
if (codeCompletion.text.isEmpty())
|
||||
continue; // It's an OverloadCandidate which has text but no typedText.
|
||||
|
||||
if (considerOnlySignals
|
||||
&& codeCompletion.completionKind != CodeCompletion::ClassCompletionKind
|
||||
&& codeCompletion.completionKind != CodeCompletion::NamespaceCompletionKind
|
||||
&& codeCompletion.completionKind != CodeCompletion::SignalCompletionKind) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Don't offer symbols that are not accessible here.
|
||||
if (codeCompletion.availability == CodeCompletion::NotAvailable
|
||||
|| codeCompletion.availability == CodeCompletion::NotAccessible) {
|
||||
|
||||
Reference in New Issue
Block a user