Commit bd10e9b0 authored by Marco Bubke's avatar Marco Bubke Committed by Nikolai Kosjar

Clang: Only apply fixits to the corresponding revision

Change-Id: I4f4136369e1b261338d444670c212565e0c6b824
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@theqtcompany.com>
parent 8345ba2d
......@@ -189,6 +189,11 @@ QList<QTextEdit::ExtraSelection> ClangDiagnosticManager::takeExtraSelections()
return extraSelections;
}
void ClangDiagnosticManager::clearDiagnosticsWithFixIts()
{
m_fixItdiagnostics.clear();
}
void ClangDiagnosticManager::generateEditorSelections()
{
m_extraSelections.clear();
......
......@@ -56,6 +56,8 @@ public:
const QVector<ClangBackEnd::DiagnosticContainer> &diagnosticsWithFixIts() const;
QList<QTextEdit::ExtraSelection> takeExtraSelections();
void clearDiagnosticsWithFixIts();
private:
QString filePath() const;
void filterDiagnostics(const QVector<ClangBackEnd::DiagnosticContainer> &diagnostics);
......
......@@ -224,6 +224,11 @@ ClangBackEnd::FileContainer ClangEditorDocumentProcessor::fileContainer() const
return fileContainer(m_projectPart.data());
}
void ClangEditorDocumentProcessor::clearDiagnosticsWithFixIts()
{
m_diagnosticManager.clearDiagnosticsWithFixIts();
}
ClangEditorDocumentProcessor *ClangEditorDocumentProcessor::get(const QString &filePath)
{
return qobject_cast<ClangEditorDocumentProcessor *>(BaseEditorDocumentProcessor::get(filePath));
......
......@@ -81,6 +81,8 @@ public:
ClangBackEnd::FileContainer fileContainer() const;
void clearDiagnosticsWithFixIts();
public:
static ClangEditorDocumentProcessor *get(const QString &filePath);
......
......@@ -197,6 +197,15 @@ void ModelManagerSupportClang::onCppDocumentReloadFinishedOnTranslationUnit(bool
}
}
namespace {
void clearDiagnosticFixIts(const QString &filePath)
{
auto processor = ClangEditorDocumentProcessor::get(filePath);
if (processor)
processor->clearDiagnosticsWithFixIts();
}
}
void ModelManagerSupportClang::onCppDocumentContentsChangedOnTranslationUnit(int position,
int /*charsRemoved*/,
int /*charsAdded*/)
......@@ -206,6 +215,8 @@ void ModelManagerSupportClang::onCppDocumentContentsChangedOnTranslationUnit(int
m_ipcCommunicator.updateChangeContentStartPosition(document->filePath().toString(),
position);
m_ipcCommunicator.updateTranslationUnitIfNotCurrentDocument(document);
clearDiagnosticFixIts(document->filePath().toString());
}
void ModelManagerSupportClang::onCppDocumentAboutToReloadOnUnsavedFile()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment