ClangCodeModel: Fix initial processor state

It is expected that the processor that is created by the provider is not
running.

Fixes: QTCREATORBUG-28769
Change-Id: Icef270c5f9255b97aa04fc3d0ea0cf872787bd24
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
David Schulz
2023-02-07 10:38:32 +01:00
parent 96ebe93ecb
commit fbcf0fb3bf
2 changed files with 6 additions and 5 deletions

View File

@@ -40,7 +40,7 @@ public:
: m_followSymbol(followSymbol) {}
void cancel() override { resetData(true); }
bool running() override { return m_followSymbol; }
bool running() override { return m_followSymbol && m_running; }
void update();
void finalize();
void resetData(bool resetFollowSymbolData);
@@ -51,10 +51,11 @@ private:
return createProposal(false);
}
IAssistProposal *createProposal(bool final) const;
IAssistProposal *createProposal(bool final);
VirtualFunctionProposalItem *createEntry(const QString &name, const Link &link) const;
QPointer<ClangdFollowSymbol> m_followSymbol;
bool m_running = false;
};
class ClangdFollowSymbol::VirtualFunctionAssistProvider : public IAssistProvider
@@ -297,10 +298,10 @@ void ClangdFollowSymbol::VirtualFunctionAssistProcessor::resetData(bool resetFol
m_followSymbol = nullptr;
}
IAssistProposal *
ClangdFollowSymbol::VirtualFunctionAssistProcessor::createProposal(bool final) const
IAssistProposal *ClangdFollowSymbol::VirtualFunctionAssistProcessor::createProposal(bool final)
{
QTC_ASSERT(m_followSymbol, return nullptr);
m_running = !final;
QList<AssistProposalItemInterface *> items;
bool needsBaseDeclEntry = !m_followSymbol->d->defLinkNode.range()

View File

@@ -489,7 +489,7 @@ void FollowSymbolTest::initTestCase()
const QString clangdFromEnv = Utils::qtcEnvironmentVariable("QTC_CLANGD");
if (clangdFromEnv.isEmpty())
return;
ClangdSettings::setClangdFilePath(Utils::FilePath::fromString(clangdFromEnv));
ClangdSettings::setClangdFilePath(Utils::FilePath::fromUserInput(clangdFromEnv));
const auto clangd = ClangdSettings::instance().clangdFilePath();
if (clangd.isEmpty() || !clangd.exists())
return;