forked from qt-creator/qt-creator
Clang: Only apply fixits to the corresponding revision
Change-Id: I4f4136369e1b261338d444670c212565e0c6b824 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
committed by
Nikolai Kosjar
parent
8345ba2d2d
commit
bd10e9b020
@@ -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()
|
||||
|
Reference in New Issue
Block a user