forked from qt-creator/qt-creator
Clang: Use new libclang code completion fix-its feature
Each completion coming from libclang now has it's own list of fix-its which are required to be applied before completion itself. This saves one extra reparse cycle and gives an ability to provide both kinds of completion (initial and corrected one) for cases like shared_ptr, unique_ptr or any other class with overloaded arrow operator. Each of these extra fix-its is applied together with corresponding completion dircetly before completion itself. Change-Id: Ide37e45bb15fa2f1375cd6b86ecd43ced3593046 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -26,7 +26,6 @@
|
||||
#include "clangassistproposalitem.h"
|
||||
|
||||
#include "clangactivationsequenceprocessor.h"
|
||||
#include "clangassistproposal.h"
|
||||
#include "clangassistproposalmodel.h"
|
||||
#include "clangcompletionassistprocessor.h"
|
||||
#include "clangcompletioncontextanalyzer.h"
|
||||
@@ -41,6 +40,7 @@
|
||||
|
||||
#include <texteditor/codeassist/assistproposalitem.h>
|
||||
#include <texteditor/codeassist/functionhintproposal.h>
|
||||
#include <texteditor/codeassist/genericproposal.h>
|
||||
#include <texteditor/codeassist/ifunctionhintproposalmodel.h>
|
||||
|
||||
#include <cplusplus/BackwardsScanner.h>
|
||||
@@ -68,7 +68,6 @@ namespace {
|
||||
|
||||
QList<AssistProposalItemInterface *> toAssistProposalItems(const CodeCompletions &completions)
|
||||
{
|
||||
|
||||
bool signalCompletion = false; // TODO
|
||||
bool slotCompletion = false; // TODO
|
||||
|
||||
@@ -143,8 +142,7 @@ static CodeCompletions filterFunctionSignatures(const CodeCompletions &completio
|
||||
}
|
||||
|
||||
void ClangCompletionAssistProcessor::handleAvailableCompletions(
|
||||
const CodeCompletions &completions,
|
||||
CompletionCorrection neededCorrection)
|
||||
const CodeCompletions &completions)
|
||||
{
|
||||
QTC_CHECK(m_completions.isEmpty());
|
||||
|
||||
@@ -154,7 +152,7 @@ void ClangCompletionAssistProcessor::handleAvailableCompletions(
|
||||
if (m_addSnippets && !m_completions.isEmpty())
|
||||
addSnippets();
|
||||
|
||||
setAsyncProposalAvailable(createProposal(neededCorrection));
|
||||
setAsyncProposalAvailable(createProposal());
|
||||
} else {
|
||||
const CodeCompletions functionSignatures = filterFunctionSignatures(completions);
|
||||
if (!functionSignatures.isEmpty())
|
||||
@@ -591,13 +589,12 @@ bool ClangCompletionAssistProcessor::sendCompletionRequest(int position,
|
||||
return false;
|
||||
}
|
||||
|
||||
TextEditor::IAssistProposal *ClangCompletionAssistProcessor::createProposal(
|
||||
CompletionCorrection neededCorrection)
|
||||
TextEditor::IAssistProposal *ClangCompletionAssistProcessor::createProposal()
|
||||
{
|
||||
m_requestSent = false;
|
||||
TextEditor::GenericProposalModelPtr model(new ClangAssistProposalModel(neededCorrection));
|
||||
TextEditor::GenericProposalModelPtr model(new ClangAssistProposalModel());
|
||||
model->loadContent(m_completions);
|
||||
return new ClangAssistProposal(m_positionForProposal, model);
|
||||
return new GenericProposal(m_positionForProposal, model);
|
||||
}
|
||||
|
||||
IAssistProposal *ClangCompletionAssistProcessor::createFunctionHintProposal(
|
||||
|
||||
Reference in New Issue
Block a user