Clang: Show inline diagnostics only for project files

When navigating to headers that are not part of the project, avoid
showing the inline diagnostics. In most cases, these files can't be
changed.

This helps also for the session-load case where files are opened/parsed
when no project information is available yet.

Change-Id: I7fce24af78b3b1efbf64dd27d8ca2a053e02d4ec
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Nikolai Kosjar
2017-07-10 09:53:34 +02:00
parent dc1bdc9bec
commit e1de989e16
6 changed files with 18 additions and 7 deletions

View File

@@ -180,7 +180,7 @@ void ClangEditorDocumentProcessor::updateCodeWarnings(
uint documentRevision)
{
if (documentRevision == revision()) {
m_diagnosticManager.processNewDiagnostics(diagnostics);
m_diagnosticManager.processNewDiagnostics(diagnostics, m_isProjectFile);
const auto codeWarnings = m_diagnosticManager.takeExtraSelections();
const auto fixitAvailableMarkers = m_diagnosticManager.takeFixItAvailableMarkers();
const auto creator = creatorForHeaderErrorDiagnosticWidget(firstHeaderErrorDiagnostic);
@@ -368,6 +368,8 @@ void ClangEditorDocumentProcessor::updateProjectPartAndTranslationUnitForEditor(
registerTranslationUnitForEditor(projectPart.data());
m_projectPart = projectPart;
m_isProjectFile = m_parser->projectPartInfo().hints
& CppTools::ProjectPartInfo::IsFromProjectMatch;
}
}