forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/9.0'
Change-Id: Ie069f3b2a1200b3e665341b1d56ce836024b0d29
This commit is contained in:
@@ -293,7 +293,8 @@ LanguageClientCompletionAssistProcessor::~LanguageClientCompletionAssistProcesso
|
||||
|
||||
QTextDocument *LanguageClientCompletionAssistProcessor::document() const
|
||||
{
|
||||
return m_document;
|
||||
QTC_ASSERT(m_assistInterface, return nullptr);
|
||||
return m_assistInterface->textDocument();
|
||||
}
|
||||
|
||||
QList<AssistProposalItemInterface *> LanguageClientCompletionAssistProcessor::generateCompletionItems(
|
||||
@@ -315,6 +316,7 @@ static QString assistReasonString(AssistReason reason)
|
||||
|
||||
IAssistProposal *LanguageClientCompletionAssistProcessor::perform(const AssistInterface *interface)
|
||||
{
|
||||
m_assistInterface.reset(interface);
|
||||
QTC_ASSERT(m_client, return nullptr);
|
||||
m_pos = interface->position();
|
||||
m_basePos = m_pos;
|
||||
@@ -366,7 +368,6 @@ IAssistProposal *LanguageClientCompletionAssistProcessor::perform(const AssistIn
|
||||
m_client->sendMessage(completionRequest);
|
||||
m_client->addAssistProcessor(this);
|
||||
m_currentRequest = completionRequest.id();
|
||||
m_document = interface->textDocument();
|
||||
m_filePath = interface->filePath();
|
||||
qCDebug(LOGLSPCOMPLETION) << QTime::currentTime()
|
||||
<< " : request completions at " << m_pos
|
||||
@@ -425,7 +426,7 @@ void LanguageClientCompletionAssistProcessor::handleCompletionResponse(
|
||||
model->loadContent(proposalItems);
|
||||
LanguageClientCompletionProposal *proposal = new LanguageClientCompletionProposal(m_basePos,
|
||||
model);
|
||||
proposal->m_document = m_document;
|
||||
proposal->m_document = m_assistInterface->textDocument();
|
||||
proposal->m_pos = m_pos;
|
||||
proposal->setSupportsPrefix(false);
|
||||
setAsyncProposalAvailable(proposal);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <texteditor/codeassist/iassistprocessor.h>
|
||||
|
||||
#include <QPointer>
|
||||
#include <QScopedPointer>
|
||||
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
@@ -74,7 +75,7 @@ protected:
|
||||
private:
|
||||
void handleCompletionResponse(const LanguageServerProtocol::CompletionRequest::Response &response);
|
||||
|
||||
QPointer<QTextDocument> m_document;
|
||||
QScopedPointer<const TextEditor::AssistInterface> m_assistInterface;
|
||||
Utils::FilePath m_filePath;
|
||||
QPointer<Client> m_client;
|
||||
std::optional<LanguageServerProtocol::MessageId> m_currentRequest;
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <texteditor/codeassist/iassistprocessor.h>
|
||||
#include <texteditor/codeassist/ifunctionhintproposalmodel.h>
|
||||
|
||||
#include <QScopedPointer>
|
||||
|
||||
using namespace TextEditor;
|
||||
using namespace LanguageServerProtocol;
|
||||
|
||||
@@ -66,6 +68,7 @@ FunctionHintProcessor::FunctionHintProcessor(Client *client)
|
||||
|
||||
IAssistProposal *FunctionHintProcessor::perform(const AssistInterface *interface)
|
||||
{
|
||||
const QScopedPointer<const AssistInterface> deleter(interface);
|
||||
QTC_ASSERT(m_client, return nullptr);
|
||||
m_pos = interface->position();
|
||||
QTextCursor cursor(interface->textDocument());
|
||||
|
||||
Reference in New Issue
Block a user