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;
|
return extraSelections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClangDiagnosticManager::clearDiagnosticsWithFixIts()
|
||||||
|
{
|
||||||
|
m_fixItdiagnostics.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void ClangDiagnosticManager::generateEditorSelections()
|
void ClangDiagnosticManager::generateEditorSelections()
|
||||||
{
|
{
|
||||||
m_extraSelections.clear();
|
m_extraSelections.clear();
|
||||||
|
@@ -56,6 +56,8 @@ public:
|
|||||||
const QVector<ClangBackEnd::DiagnosticContainer> &diagnosticsWithFixIts() const;
|
const QVector<ClangBackEnd::DiagnosticContainer> &diagnosticsWithFixIts() const;
|
||||||
QList<QTextEdit::ExtraSelection> takeExtraSelections();
|
QList<QTextEdit::ExtraSelection> takeExtraSelections();
|
||||||
|
|
||||||
|
void clearDiagnosticsWithFixIts();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString filePath() const;
|
QString filePath() const;
|
||||||
void filterDiagnostics(const QVector<ClangBackEnd::DiagnosticContainer> &diagnostics);
|
void filterDiagnostics(const QVector<ClangBackEnd::DiagnosticContainer> &diagnostics);
|
||||||
|
@@ -224,6 +224,11 @@ ClangBackEnd::FileContainer ClangEditorDocumentProcessor::fileContainer() const
|
|||||||
return fileContainer(m_projectPart.data());
|
return fileContainer(m_projectPart.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClangEditorDocumentProcessor::clearDiagnosticsWithFixIts()
|
||||||
|
{
|
||||||
|
m_diagnosticManager.clearDiagnosticsWithFixIts();
|
||||||
|
}
|
||||||
|
|
||||||
ClangEditorDocumentProcessor *ClangEditorDocumentProcessor::get(const QString &filePath)
|
ClangEditorDocumentProcessor *ClangEditorDocumentProcessor::get(const QString &filePath)
|
||||||
{
|
{
|
||||||
return qobject_cast<ClangEditorDocumentProcessor *>(BaseEditorDocumentProcessor::get(filePath));
|
return qobject_cast<ClangEditorDocumentProcessor *>(BaseEditorDocumentProcessor::get(filePath));
|
||||||
|
@@ -81,6 +81,8 @@ public:
|
|||||||
|
|
||||||
ClangBackEnd::FileContainer fileContainer() const;
|
ClangBackEnd::FileContainer fileContainer() const;
|
||||||
|
|
||||||
|
void clearDiagnosticsWithFixIts();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static ClangEditorDocumentProcessor *get(const QString &filePath);
|
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,
|
void ModelManagerSupportClang::onCppDocumentContentsChangedOnTranslationUnit(int position,
|
||||||
int /*charsRemoved*/,
|
int /*charsRemoved*/,
|
||||||
int /*charsAdded*/)
|
int /*charsAdded*/)
|
||||||
@@ -206,6 +215,8 @@ void ModelManagerSupportClang::onCppDocumentContentsChangedOnTranslationUnit(int
|
|||||||
m_ipcCommunicator.updateChangeContentStartPosition(document->filePath().toString(),
|
m_ipcCommunicator.updateChangeContentStartPosition(document->filePath().toString(),
|
||||||
position);
|
position);
|
||||||
m_ipcCommunicator.updateTranslationUnitIfNotCurrentDocument(document);
|
m_ipcCommunicator.updateTranslationUnitIfNotCurrentDocument(document);
|
||||||
|
|
||||||
|
clearDiagnosticFixIts(document->filePath().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelManagerSupportClang::onCppDocumentAboutToReloadOnUnsavedFile()
|
void ModelManagerSupportClang::onCppDocumentAboutToReloadOnUnsavedFile()
|
||||||
|
Reference in New Issue
Block a user