Editor: unify assist processor handling

Define the run type of the processor by its implementation instead of a
enum value of the provider. The execution of a processor inside the
assist now follows a unified procedure.

Change-Id: Ibe9fab324c6072e77702c2663946d7a9f562a085
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
David Schulz
2022-11-09 15:38:22 +01:00
parent 33a33612c8
commit 09ee528c40
45 changed files with 230 additions and 377 deletions

View File

@@ -46,7 +46,7 @@ public:
unsigned completionOperator, CustomAssistMode mode);
private:
IAssistProposal *perform(const AssistInterface *interface) override;
IAssistProposal *perform(AssistInterface *interface) override;
AssistProposalItemInterface *createItem(const QString &text, const QIcon &icon) const;
@@ -85,7 +85,7 @@ public:
~ClangdCompletionAssistProcessor();
private:
IAssistProposal *perform(const AssistInterface *interface) override;
IAssistProposal *perform(AssistInterface *interface) override;
QList<AssistProposalItemInterface *> generateCompletionItems(
const QList<LanguageServerProtocol::CompletionItem> &items) const override;
@@ -99,7 +99,7 @@ public:
ClangdFunctionHintProcessor(ClangdClient *client);
private:
IAssistProposal *perform(const AssistInterface *interface) override;
IAssistProposal *perform(AssistInterface *interface) override;
ClangdClient * const m_client;
};
@@ -152,7 +152,7 @@ IAssistProcessor *ClangdCompletionAssistProvider::createProcessor(
if (contextAnalyzer.completionAction()
!= ClangCompletionContextAnalyzer::CompleteIncludePath) {
class NoOpProcessor : public IAssistProcessor {
IAssistProposal *perform(const AssistInterface *) override { return nullptr; }
IAssistProposal *perform(AssistInterface *) override { return nullptr; }
};
return new NoOpProcessor;
}
@@ -402,7 +402,7 @@ CustomAssistProcessor::CustomAssistProcessor(ClangdClient *client, int position,
, m_mode(mode)
{}
IAssistProposal *CustomAssistProcessor::perform(const AssistInterface *interface)
IAssistProposal *CustomAssistProcessor::perform(AssistInterface *interface)
{
QList<AssistProposalItemInterface *> completions;
switch (m_mode) {
@@ -568,7 +568,7 @@ ClangdCompletionAssistProcessor::~ClangdCompletionAssistProcessor()
<< "ClangdCompletionAssistProcessor took: " << m_timer.elapsed() << " ms";
}
IAssistProposal *ClangdCompletionAssistProcessor::perform(const AssistInterface *interface)
IAssistProposal *ClangdCompletionAssistProcessor::perform(AssistInterface *interface)
{
if (m_client->testingEnabled()) {
setAsyncCompletionAvailableHandler([this](IAssistProposal *proposal) {
@@ -614,7 +614,7 @@ ClangdFunctionHintProcessor::ClangdFunctionHintProcessor(ClangdClient *client)
, m_client(client)
{}
IAssistProposal *ClangdFunctionHintProcessor::perform(const AssistInterface *interface)
IAssistProposal *ClangdFunctionHintProcessor::perform(AssistInterface *interface)
{
if (m_client->testingEnabled()) {
setAsyncCompletionAvailableHandler([this](IAssistProposal *proposal) {

View File

@@ -42,18 +42,12 @@ public:
void resetData(bool resetFollowSymbolData);
private:
IAssistProposal *perform(const AssistInterface *interface) override
IAssistProposal *perform(AssistInterface *interface) override
{
delete interface;
return nullptr;
}
IAssistProposal *immediateProposal(const AssistInterface *) override
{
return createProposal(false);
}
IAssistProposal *immediateProposalImpl() const;
IAssistProposal *createProposal(bool final) const;
VirtualFunctionProposalItem *createEntry(const QString &name, const Link &link) const;
@@ -67,7 +61,6 @@ public:
: m_followSymbol(followSymbol) {}
private:
RunType runType() const override { return Asynchronous; }
IAssistProcessor *createProcessor(const AssistInterface *) const override;
const QPointer<ClangdFollowSymbol> m_followSymbol;

View File

@@ -47,7 +47,7 @@ public:
}
private:
IAssistProposal *perform(const AssistInterface *interface) override
IAssistProposal *perform(AssistInterface *interface) override
{
m_interface = interface;