forked from qt-creator/qt-creator
Clang: Show function signature hint for constructors and functors
For "foo(|" [1] we requested a completion from libclang with the cursor position just before "foo" and then filtered the function declarations for functions matching the name "foo". This worked fine for ordinary functions, but obviously not for constructors and functors. Recent versions of libclang support proper function call completion with XCursor_OverloadCandidate, so make use of that. [1] '|' represents the cursor position Task-number: QTCREATORBUG-14882 Task-number: QTCREATORBUG-14884 Change-Id: I9d31b3960ccff6a8b9440dbcb7ff9f5ca9f61266 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -50,8 +50,8 @@ public:
|
||||
|
||||
TextEditor::IAssistProposal *perform(const TextEditor::AssistInterface *interface) override;
|
||||
|
||||
bool handleAvailableAsyncCompletions(const CodeCompletions &completions,
|
||||
CompletionCorrection neededCorrection);
|
||||
void handleAvailableCompletions(const CodeCompletions &completions,
|
||||
CompletionCorrection neededCorrection);
|
||||
|
||||
const TextEditor::TextEditorWidget *textEditorWidget() const;
|
||||
|
||||
@@ -63,6 +63,8 @@ private:
|
||||
|
||||
TextEditor::IAssistProposal *createProposal(
|
||||
CompletionCorrection neededCorrection = CompletionCorrection::NoCorrection) const;
|
||||
TextEditor::IAssistProposal *createFunctionHintProposal(
|
||||
const CodeCompletions &completions) const;
|
||||
|
||||
bool completeInclude(const QTextCursor &cursor);
|
||||
bool completeInclude(int position);
|
||||
@@ -82,15 +84,10 @@ private:
|
||||
void sendFileContent(const QByteArray &customFileContent);
|
||||
bool sendCompletionRequest(int position, const QByteArray &customFileContent);
|
||||
|
||||
void handleAvailableCompletions(const CodeCompletions &completions,
|
||||
CompletionCorrection neededCorrection);
|
||||
bool handleAvailableFunctionHintCompletions(const CodeCompletions &completions);
|
||||
|
||||
private:
|
||||
QScopedPointer<const ClangCompletionAssistInterface> m_interface;
|
||||
unsigned m_completionOperator;
|
||||
enum CompletionRequestType { NormalCompletion, FunctionHintCompletion } m_sentRequestType;
|
||||
QString m_functionName; // For type == Type::FunctionHintCompletion
|
||||
bool m_addSnippets = false; // For type == Type::NormalCompletion
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user