Commit 889237f9 authored by Nikolai Kosjar's avatar Nikolai Kosjar
Browse files

Clang: Mini refactorings in ClangCompletionAssistProcessor



The renames will improve the readability of the follo-up change.

Change-Id: If1f5ae2a2798c13ce7268e436dae1b3963f01d5e
Reviewed-by: default avatarMarco Bubke <marco.bubke@theqtcompany.com>
parent ae5d92d6
...@@ -146,7 +146,7 @@ void IpcReceiver::codeCompleted(const CodeCompletedCommand &command) ...@@ -146,7 +146,7 @@ void IpcReceiver::codeCompleted(const CodeCompletedCommand &command)
const quint64 ticket = command.ticketNumber(); const quint64 ticket = command.ticketNumber();
QScopedPointer<ClangCompletionAssistProcessor> processor(m_assistProcessorsTable.take(ticket)); QScopedPointer<ClangCompletionAssistProcessor> processor(m_assistProcessorsTable.take(ticket));
if (processor) if (processor)
processor->asyncCompletionsAvailable(command.codeCompletions()); processor->handleAvailableAsyncCompletions(command.codeCompletions());
} }
void IpcReceiver::translationUnitDoesNotExist(const TranslationUnitDoesNotExistCommand &command) void IpcReceiver::translationUnitDoesNotExist(const TranslationUnitDoesNotExistCommand &command)
......
...@@ -232,14 +232,15 @@ IAssistProposal *ClangCompletionAssistProcessor::perform(const AssistInterface * ...@@ -232,14 +232,15 @@ IAssistProposal *ClangCompletionAssistProcessor::perform(const AssistInterface *
return startCompletionHelper(); // == 0 if results are calculated asynchronously return startCompletionHelper(); // == 0 if results are calculated asynchronously
} }
void ClangCompletionAssistProcessor::asyncCompletionsAvailable(const CodeCompletions &completions) void ClangCompletionAssistProcessor::handleAvailableAsyncCompletions(
const CodeCompletions &completions)
{ {
switch (m_sentRequestType) { switch (m_sentRequestType) {
case CompletionRequestType::NormalCompletion: case CompletionRequestType::NormalCompletion:
onCompletionsAvailable(completions); handleAvailableCompletions(completions);
break; break;
case CompletionRequestType::FunctionHintCompletion: case CompletionRequestType::FunctionHintCompletion:
onFunctionHintCompletionsAvailable(completions); handleAvailableFunctionHintCompletions(completions);
break; break;
default: default:
QTC_CHECK(!"Unhandled ClangCompletionAssistProcessor::CompletionRequestType"); QTC_CHECK(!"Unhandled ClangCompletionAssistProcessor::CompletionRequestType");
...@@ -692,7 +693,7 @@ TextEditor::IAssistProposal *ClangCompletionAssistProcessor::createProposal() co ...@@ -692,7 +693,7 @@ TextEditor::IAssistProposal *ClangCompletionAssistProcessor::createProposal() co
return new ClangAssistProposal(m_positionForProposal, model); return new ClangAssistProposal(m_positionForProposal, model);
} }
void ClangCompletionAssistProcessor::onCompletionsAvailable(const CodeCompletions &completions) void ClangCompletionAssistProcessor::handleAvailableCompletions(const CodeCompletions &completions)
{ {
QTC_CHECK(m_completions.isEmpty()); QTC_CHECK(m_completions.isEmpty());
...@@ -703,15 +704,15 @@ void ClangCompletionAssistProcessor::onCompletionsAvailable(const CodeCompletion ...@@ -703,15 +704,15 @@ void ClangCompletionAssistProcessor::onCompletionsAvailable(const CodeCompletion
setAsyncProposalAvailable(createProposal()); setAsyncProposalAvailable(createProposal());
} }
void ClangCompletionAssistProcessor::onFunctionHintCompletionsAvailable( void ClangCompletionAssistProcessor::handleAvailableFunctionHintCompletions(
const CodeCompletions &completions) const CodeCompletions &completions)
{ {
QTC_CHECK(!m_functionName.isEmpty()); QTC_CHECK(!m_functionName.isEmpty());
const auto relevantCompletions = matchingFunctionCompletions(completions, m_functionName); const auto relevantCompletions = matchingFunctionCompletions(completions, m_functionName);
if (!relevantCompletions.isEmpty()) { if (!relevantCompletions.isEmpty()) {
TextEditor::IFunctionHintProposalModel *model = new ClangFunctionHintModel(relevantCompletions); auto *model = new ClangFunctionHintModel(relevantCompletions);
TextEditor::FunctionHintProposal *proposal = new FunctionHintProposal(m_positionForProposal, model); auto *proposal = new FunctionHintProposal(m_positionForProposal, model);
setAsyncProposalAvailable(proposal); setAsyncProposalAvailable(proposal);
} else { } else {
......
...@@ -59,7 +59,7 @@ public: ...@@ -59,7 +59,7 @@ public:
TextEditor::IAssistProposal *perform(const TextEditor::AssistInterface *interface) override; TextEditor::IAssistProposal *perform(const TextEditor::AssistInterface *interface) override;
void asyncCompletionsAvailable(const CodeCompletions &completions); void handleAvailableAsyncCompletions(const CodeCompletions &completions);
const TextEditor::TextEditorWidget *textEditorWidget() const; const TextEditor::TextEditorWidget *textEditorWidget() const;
...@@ -90,8 +90,8 @@ private: ...@@ -90,8 +90,8 @@ private:
void sendFileContent(const QString &projectPartId, const QByteArray &customFileContent); void sendFileContent(const QString &projectPartId, const QByteArray &customFileContent);
void sendCompletionRequest(int position, const QByteArray &customFileContent); void sendCompletionRequest(int position, const QByteArray &customFileContent);
void onCompletionsAvailable(const CodeCompletions &completions); void handleAvailableCompletions(const CodeCompletions &completions);
void onFunctionHintCompletionsAvailable(const CodeCompletions &completions); void handleAvailableFunctionHintCompletions(const CodeCompletions &completions);
private: private:
QScopedPointer<const ClangCompletionAssistInterface> m_interface; QScopedPointer<const ClangCompletionAssistInterface> m_interface;
......
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