forked from qt-creator/qt-creator
Utils: Add factory functions for ChangeSet
This greatly simplifies code that produces change sets with a single EditOp. Change-Id: If042bb91e5132b7141d88404cfbd3ba12632b52d Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -187,9 +187,7 @@ public:
|
||||
for (const QString &property : std::as_const(result))
|
||||
replacement += property + QLatin1String(": ") + propertyReader.readAstValue(property) + QLatin1Char('\n');
|
||||
|
||||
Utils::ChangeSet changes;
|
||||
changes.replace(start, end, replacement);
|
||||
currentFile->apply(changes);
|
||||
currentFile->apply(ChangeSet::makeReplace(start, end, replacement));
|
||||
|
||||
Core::IVersionControl *versionControl = Core::VcsManager::findVersionControlForDirectory(
|
||||
path);
|
||||
|
||||
@@ -116,10 +116,9 @@ public:
|
||||
const QmlJSRefactoringChanges &,
|
||||
const QString &) override
|
||||
{
|
||||
Utils::ChangeSet changes;
|
||||
const int insertLoc = _message.location.begin() - _message.location.startColumn + 1;
|
||||
changes.insert(insertLoc, QString::fromLatin1("// %1\n").arg(_message.suppressionString()));
|
||||
currentFile->apply(changes);
|
||||
currentFile->apply(Utils::ChangeSet::makeInsert(
|
||||
_message.location.begin() - _message.location.startColumn + 1,
|
||||
QString::fromLatin1("// %1\n").arg(_message.suppressionString())));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user