C++: Offer only signals when completing in a connect() call

... at the second argument.
The logic is as follows: The clang code model checks whether the set of
completions contains any signals. If so, it instructs the built-in code
model to analyze the AST to find out whether the completion location was
at the second argument of a call to QObject::connect(). In that case, we
filter out all non-signals, because they are not valid at that location.

Fixes: QTCREATORBUG-13558
Change-Id: I9c7d0bd16161c723aef822280626cd06ece7df93
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2020-08-25 14:32:56 +02:00
parent b938764820
commit a79b0c6558
6 changed files with 266 additions and 17 deletions

View File

@@ -66,6 +66,8 @@ private:
TextEditor::IAssistProposal *createFunctionHintProposal(
const CodeCompletions &completions);
QList<TextEditor::AssistProposalItemInterface *> toAssistProposalItems(
const CodeCompletions &completions) const;
bool completeInclude(const QTextCursor &cursor);
bool completeInclude(int position);
void completeIncludePath(const QString &realPath, const QStringList &suffixes);
@@ -96,6 +98,8 @@ private:
unsigned m_completionOperator;
enum CompletionRequestType { NormalCompletion, FunctionHintCompletion };
CompletionRequestType m_sentRequestType = NormalCompletion;
int m_position = -1;
QByteArray m_content;
bool m_requestSent = false;
bool m_addSnippets = false; // For type == Type::NormalCompletion
bool m_fallbackToNormalCompletion = true;