forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/master' into work
Change-Id: I2235a55a599aaeca5d2b5377300a044b66c17da9
This commit is contained in:
@@ -63,6 +63,7 @@
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include <cmath>
|
||||
#include <new>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
@@ -839,7 +840,7 @@ void ClangdClient::followSymbol(TextDocument *document,
|
||||
d->followSymbol = nullptr;
|
||||
|
||||
const QTextCursor adjustedCursor = d->adjustedCursor(cursor, document);
|
||||
if (!resolveTarget) {
|
||||
if (followTo == FollowTo::SymbolDef && !resolveTarget) {
|
||||
symbolSupport().findLinkAt(document, adjustedCursor, callback, false);
|
||||
return;
|
||||
}
|
||||
@@ -1356,8 +1357,13 @@ void ClangdClient::Private::handleSemanticTokens(TextDocument *doc,
|
||||
doc = QPointer(doc), rev = doc->document()->revision(),
|
||||
clangdVersion = q->versionNumber(),
|
||||
this] {
|
||||
return Utils::runAsync(doSemanticHighlighting, filePath, tokens, text, ast, doc, rev,
|
||||
clangdVersion, highlightingTimer);
|
||||
try {
|
||||
return Utils::runAsync(doSemanticHighlighting, filePath, tokens, text, ast, doc,
|
||||
rev, clangdVersion, highlightingTimer);
|
||||
} catch (const std::exception &e) {
|
||||
qWarning() << "caught" << e.what() << "in main highlighting thread";
|
||||
return QFuture<HighlightingResult>();
|
||||
}
|
||||
};
|
||||
|
||||
if (isTesting) {
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#include <QtConcurrent>
|
||||
#include <QTextDocument>
|
||||
|
||||
#include <new>
|
||||
|
||||
using namespace LanguageClient;
|
||||
using namespace LanguageServerProtocol;
|
||||
using namespace TextEditor;
|
||||
@@ -345,7 +347,15 @@ void doSemanticHighlighting(
|
||||
return HighlightingResult(token.line, token.column, token.length, styles);
|
||||
};
|
||||
|
||||
auto results = QtConcurrent::blockingMapped<HighlightingResults>(tokens, toResult);
|
||||
const auto safeToResult = [&toResult](const ExpandedSemanticToken &token) {
|
||||
try {
|
||||
return toResult(token);
|
||||
} catch (const std::exception &e) {
|
||||
qWarning() << "caught" << e.what() << "in toResult()";
|
||||
return HighlightingResult();
|
||||
}
|
||||
};
|
||||
auto results = QtConcurrent::blockingMapped<HighlightingResults>(tokens, safeToResult);
|
||||
const QList<BlockRange> ifdefedOutBlocks = cleanupDisabledCode(results, &doc, docContents);
|
||||
ExtraHighlightingResultsCollector(future, results, filePath, ast, &doc, docContents,
|
||||
clangdVersion).collect();
|
||||
|
||||
@@ -270,6 +270,19 @@ void ClangModelManagerSupport::followSymbol(const CppEditor::CursorInEditor &dat
|
||||
CppModelManager::Backend::Builtin);
|
||||
}
|
||||
|
||||
void ClangModelManagerSupport::followSymbolToType(const CppEditor::CursorInEditor &data,
|
||||
const Utils::LinkHandler &processLinkCallback,
|
||||
bool inNextSplit)
|
||||
{
|
||||
if (ClangdClient * const client = clientForFile(data.filePath())) {
|
||||
client->followSymbol(data.textDocument(), data.cursor(), data.editorWidget(),
|
||||
processLinkCallback, false, FollowTo::SymbolType, inNextSplit);
|
||||
return;
|
||||
}
|
||||
CppModelManager::followSymbolToType(data, processLinkCallback, inNextSplit,
|
||||
CppModelManager::Backend::Builtin);
|
||||
}
|
||||
|
||||
void ClangModelManagerSupport::switchDeclDef(const CppEditor::CursorInEditor &data,
|
||||
const Utils::LinkHandler &processLinkCallback)
|
||||
{
|
||||
|
||||
@@ -52,6 +52,9 @@ private:
|
||||
void followSymbol(const CppEditor::CursorInEditor &data,
|
||||
const Utils::LinkHandler &processLinkCallback, bool resolveTarget,
|
||||
bool inNextSplit) override;
|
||||
void followSymbolToType(const CppEditor::CursorInEditor &data,
|
||||
const Utils::LinkHandler &processLinkCallback,
|
||||
bool inNextSplit) override;
|
||||
void switchDeclDef(const CppEditor::CursorInEditor &data,
|
||||
const Utils::LinkHandler &processLinkCallback) override;
|
||||
void startLocalRenaming(const CppEditor::CursorInEditor &data,
|
||||
|
||||
Reference in New Issue
Block a user