forked from qt-creator/qt-creator
Clang: extra clangbackend job to collect full token info
Limit document annotations job to only highlighting data collection and move more expensive calls into separate job that runs after it. Change-Id: Ie792a3f741ac45c81033dd5b3a20ed061604f927 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -202,20 +202,26 @@ void BackendReceiver::documentAnnotationsChanged(const DocumentAnnotationsChange
|
||||
|
||||
auto processor = ClangEditorDocumentProcessor::get(message.fileContainer().filePath());
|
||||
|
||||
if (processor) {
|
||||
const QString projectPartId = message.fileContainer().projectPartId();
|
||||
const QString filePath = message.fileContainer().filePath();
|
||||
const QString documentProjectPartId = CppTools::CppToolsBridge::projectPartIdForFile(filePath);
|
||||
if (projectPartId == documentProjectPartId) {
|
||||
const quint32 documentRevision = message.fileContainer().documentRevision();
|
||||
processor->updateCodeWarnings(message.diagnostics(),
|
||||
message.firstHeaderErrorDiagnostic(),
|
||||
documentRevision);
|
||||
processor->updateHighlighting(message.tokenInfos(),
|
||||
message.skippedPreprocessorRanges(),
|
||||
documentRevision);
|
||||
}
|
||||
if (!processor)
|
||||
return;
|
||||
|
||||
const QString projectPartId = message.fileContainer().projectPartId();
|
||||
const QString filePath = message.fileContainer().filePath();
|
||||
const QString documentProjectPartId = CppTools::CppToolsBridge::projectPartIdForFile(filePath);
|
||||
if (projectPartId != documentProjectPartId)
|
||||
return;
|
||||
|
||||
const quint32 documentRevision = message.fileContainer().documentRevision();
|
||||
if (message.onlyTokenInfos()) {
|
||||
processor->updateTokenInfos(message.tokenInfos(), documentRevision);
|
||||
return;
|
||||
}
|
||||
processor->updateCodeWarnings(message.diagnostics(),
|
||||
message.firstHeaderErrorDiagnostic(),
|
||||
documentRevision);
|
||||
processor->updateHighlighting(message.tokenInfos(),
|
||||
message.skippedPreprocessorRanges(),
|
||||
documentRevision);
|
||||
}
|
||||
|
||||
static
|
||||
|
||||
@@ -260,6 +260,15 @@ void ClangEditorDocumentProcessor::updateHighlighting(
|
||||
}
|
||||
}
|
||||
|
||||
void ClangEditorDocumentProcessor::updateTokenInfos(
|
||||
const QVector<ClangBackEnd::TokenInfoContainer> &tokenInfos,
|
||||
uint documentRevision)
|
||||
{
|
||||
if (documentRevision != revision())
|
||||
return;
|
||||
m_tokenInfos = tokenInfos;
|
||||
}
|
||||
|
||||
static int currentLine(const TextEditor::AssistInterface &assistInterface)
|
||||
{
|
||||
int line, column;
|
||||
|
||||
@@ -76,6 +76,8 @@ public:
|
||||
void updateHighlighting(const QVector<ClangBackEnd::TokenInfoContainer> &tokenInfos,
|
||||
const QVector<ClangBackEnd::SourceRangeContainer> &skippedPreprocessorRanges,
|
||||
uint documentRevision);
|
||||
void updateTokenInfos(const QVector<ClangBackEnd::TokenInfoContainer> &tokenInfos,
|
||||
uint documentRevision);
|
||||
|
||||
TextEditor::QuickFixOperations
|
||||
extraRefactoringOperations(const TextEditor::AssistInterface &assistInterface) override;
|
||||
|
||||
@@ -83,12 +83,12 @@ static Utils::Link linkAtCursor(QTextCursor cursor, const QString &filePath, uin
|
||||
Link token(filePath, mark.line(), mark.column());
|
||||
token.linkTextStart = getMarkPos(cursor, mark);
|
||||
token.linkTextEnd = token.linkTextStart + mark.length();
|
||||
if (mark.isIncludeDirectivePath()) {
|
||||
if (mark.extraInfo().includeDirectivePath) {
|
||||
if (tokenStr != "include" && tokenStr != "#" && tokenStr != "<")
|
||||
return token;
|
||||
return Link();
|
||||
}
|
||||
if (mark.isIdentifier() || tokenStr == "operator")
|
||||
if (mark.extraInfo().identifier || tokenStr == "operator")
|
||||
return token;
|
||||
return Link();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user