ClangTools: Add QuickFixes to the editor

Change-Id: I9862231f0aa8e8274e8529e57e80eac5ececded9
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
David Schulz
2020-08-25 06:18:26 +02:00
parent b55a313b3d
commit ef10f3b937
14 changed files with 284 additions and 12 deletions

View File

@@ -26,6 +26,7 @@
#include "virtualfilesystemoverlay.h"
#include <coreplugin/documentmanager.h>
#include <coreplugin/editormanager/documentmodel.h>
#include <texteditor/textdocument.h>
#include <QJsonArray>
@@ -80,6 +81,9 @@ void VirtualFileSystemOverlay::update()
qCDebug(LOG) << error;
}
m_saved = newSaved;
m_mapping.clear();
for (auto it = m_saved.constBegin(), end = m_saved.constEnd(); it != end; ++it)
m_mapping[it.value().path] = it.key()->filePath();
auto toContent = [this](Core::IDocument *document) {
QJsonObject content;
@@ -112,7 +116,7 @@ void VirtualFileSystemOverlay::update()
Utils::FilePath VirtualFileSystemOverlay::overlayFilePath() { return m_overlayFilePath; }
Utils::FilePath VirtualFileSystemOverlay::filePath(Core::IDocument *doc)
Utils::FilePath VirtualFileSystemOverlay::autoSavedFilePath(Core::IDocument *doc)
{
auto it = m_saved.find(doc);
if (it != m_saved.end())
@@ -120,5 +124,10 @@ Utils::FilePath VirtualFileSystemOverlay::filePath(Core::IDocument *doc)
return doc->filePath();
}
Utils::FilePath VirtualFileSystemOverlay::originalFilePath(const Utils::FilePath &file)
{
return m_mapping.value(file, file);
}
} // namespace Internal
} // namespace ClangTools