forked from qt-creator/qt-creator
TextEditor: Get rid of extra indent ranges in RefactoringFile
Having extra indent regions complicates the interface, the implementation and the calling code. Instead, derive the indent regions from the change set and let callers opt out for the relatively few cases where indentation is not desired. Change-Id: I49d2854830a51778534ef260fb5c9f2c7685554a Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -190,7 +190,6 @@ public:
|
||||
Utils::ChangeSet changes;
|
||||
changes.replace(start, end, replacement);
|
||||
currentFile->setChangeSet(changes);
|
||||
currentFile->appendIndentRange(Range(start, end + 1));
|
||||
currentFile->apply();
|
||||
|
||||
Core::IVersionControl *versionControl = Core::VcsManager::findVersionControlForDirectory(
|
||||
|
||||
@@ -71,8 +71,6 @@ public:
|
||||
QLatin1String("\n"));
|
||||
|
||||
currentFile->setChangeSet(changes);
|
||||
currentFile->appendIndentRange(Range(currentFile->startOf(_objectInitializer->lbraceToken),
|
||||
currentFile->startOf(_objectInitializer->rbraceToken)));
|
||||
currentFile->apply();
|
||||
}
|
||||
};
|
||||
@@ -123,7 +121,6 @@ public:
|
||||
const int insertLoc = _message.location.begin() - _message.location.startColumn + 1;
|
||||
changes.insert(insertLoc, QString::fromLatin1("// %1\n").arg(_message.suppressionString()));
|
||||
currentFile->setChangeSet(changes);
|
||||
currentFile->appendIndentRange(Range(insertLoc, insertLoc + 1));
|
||||
currentFile->apply();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -147,7 +147,6 @@ public:
|
||||
" sourceComponent: %1\n"
|
||||
"}\n").arg(componentId, loaderId));
|
||||
currentFile->setChangeSet(changes);
|
||||
currentFile->appendIndentRange(Range(objDefStart, objDefEnd));
|
||||
currentFile->apply();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -860,9 +860,6 @@ void QmlOutlineModel::reparentNodes(QmlOutlineItem *targetItem, int row, QList<Q
|
||||
QmlJSRefactoringChanges refactoring(ModelManagerInterface::instance(), m_semanticInfo.snapshot);
|
||||
TextEditor::RefactoringFilePtr file = refactoring.file(m_semanticInfo.document->fileName());
|
||||
file->setChangeSet(changeSet);
|
||||
for (const Utils::ChangeSet::Range &range : std::as_const(changedRanges)) {
|
||||
file->appendIndentRange(range);
|
||||
}
|
||||
file->apply();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user