Clang: Show current editor diagnostics in issues pane

This helps to deal with many diagnostics.

Error diagnostics precede warning diagnostis to have them on top.
If no CppEditor is active, no diagnostics are displayed.

Previously one had to scroll the document up and down to locate the
diagnostics. Now they are in a list and can be easily navigated with
F6/Shift-F6. Also, at least for some diagnostics "Get Help Online" from
the context menu seems to provide useful results. For example,
triggering the action on clang tidy issues will open the web browser
with some good hits explaining the issues.

Change-Id: Idabe30b0961d893bee39ccee431e92aeeda1cc26
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-04-12 14:49:07 +02:00
parent dd231fa754
commit 7be7d26814
7 changed files with 91 additions and 1 deletions

View File

@@ -160,9 +160,20 @@ CppTools::BaseEditorDocumentProcessor *ModelManagerSupportClang::createEditorDoc
return new ClangEditorDocumentProcessor(m_communicator, baseTextDocument);
}
void ModelManagerSupportClang::onCurrentEditorChanged(Core::IEditor *)
void ModelManagerSupportClang::onCurrentEditorChanged(Core::IEditor *editor)
{
m_communicator.updateTranslationUnitVisiblity();
// Update task hub issues for current CppEditorDocument
QTC_ASSERT(editor, return);
Core::IDocument *document = editor->document();
QTC_ASSERT(document, return);
TextEditor::TextDocument *textDocument = qobject_cast<TextEditor::TextDocument *>(document);
auto processor = ClangEditorDocumentProcessor::get(document->filePath().toString());
processor->clearTaskHubIssues();
if (textDocument && cppModelManager()->isCppEditor(editor))
processor->generateTaskHubIssues();
}
void ModelManagerSupportClang::connectTextDocumentToTranslationUnit(TextEditor::TextDocument *textDocument)