Merge remote-tracking branch 'origin/6.0'

Change-Id: I3bab4e31bc5993c59c7025ebde0846bf6c75810e
This commit is contained in:
Eike Ziller
2021-11-19 10:44:15 +01:00
82 changed files with 706 additions and 229 deletions

View File

@@ -136,10 +136,15 @@ void LanguageClientManager::clientStarted(Client *client)
qCDebug(Log) << "client started: " << client->name() << client;
QTC_ASSERT(managerInstance, return);
QTC_ASSERT(client, return);
if (managerInstance->m_shuttingDown)
if (managerInstance->m_shuttingDown) {
clientFinished(client);
else
client->initialize();
return;
}
client->initialize();
const QList<TextEditor::TextDocument *> &clientDocs
= managerInstance->m_clientForDocument.keys(client);
for (TextEditor::TextDocument *document : clientDocs)
client->openDocument(document);
}
void LanguageClientManager::clientFinished(Client *client)

View File

@@ -261,7 +261,7 @@ void SemanticTokenSupport::updateSemanticTokens(TextDocument *textDocument)
void SemanticTokenSupport::rehighlight()
{
for (const Utils::FilePath &filePath : m_tokens.keys())
highlight(filePath);
highlight(filePath, true);
}
void addModifiers(int key,
@@ -369,6 +369,8 @@ void SemanticTokenSupport::setAdditionalTokenTypeStyles(
SemanticRequestTypes SemanticTokenSupport::supportedSemanticRequests(TextDocument *document) const
{
if (!m_client->documentOpen(document))
return SemanticRequestType::None;
auto supportedRequests = [&](const QJsonObject &options) -> SemanticRequestTypes {
TextDocumentRegistrationOptions docOptions(options);
if (docOptions.isValid()
@@ -472,7 +474,7 @@ void SemanticTokenSupport::handleSemanticTokensDelta(
highlight(filePath);
}
void SemanticTokenSupport::highlight(const Utils::FilePath &filePath)
void SemanticTokenSupport::highlight(const Utils::FilePath &filePath, bool force)
{
TextDocument *doc = TextDocument::textDocumentForFilePath(filePath);
if (!doc || LanguageClientManager::clientForDocument(doc) != m_client)
@@ -515,7 +517,7 @@ void SemanticTokenSupport::highlight(const Utils::FilePath &filePath)
}
}
m_tokensHandler(doc, expandedTokens, versionedTokens.version);
m_tokensHandler(doc, expandedTokens, versionedTokens.version, force);
return;
}
int line = 1;

View File

@@ -56,7 +56,7 @@ inline bool operator==(const ExpandedSemanticToken &t1, const ExpandedSemanticTo
&& t1.type == t2.type && t1.modifiers == t2.modifiers;
}
using SemanticTokensHandler = std::function<void(TextEditor::TextDocument *,
const QList<ExpandedSemanticToken> &, int)>;
const QList<ExpandedSemanticToken> &, int, bool)>;
namespace SemanticHighligtingSupport {
@@ -99,7 +99,7 @@ private:
void handleSemanticTokensDelta(const Utils::FilePath &filePath,
const LanguageServerProtocol::SemanticTokensDeltaResult &result,
int documentVersion);
void highlight(const Utils::FilePath &filePath);
void highlight(const Utils::FilePath &filePath, bool force = false);
void updateFormatHash();
void currentEditorChanged();
void onCurrentEditorChanged(Core::IEditor *editor);