TextEditor: filepathify RefactoringChanges

Change-Id: Ie97e484bcdeaa0cb2f5d04b3c79ace55ff2e426c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2021-05-28 12:02:36 +02:00
parent 15e4649fe8
commit 79b9a2fea6
21 changed files with 238 additions and 195 deletions

View File

@@ -187,7 +187,8 @@ public:
// stop if we can't create the new file
const bool reindent = true;
const bool openEditor = false;
if (!refactoring.createFile(newFileName, newComponentSource, reindent, openEditor))
const Utils::FilePath newFilePath = Utils::FilePath::fromString(newFileName);
if (!refactoring.createFile(newFilePath, newComponentSource, reindent, openEditor))
return;
if (path == QFileInfo(currentFileName).path()) {
@@ -264,7 +265,7 @@ void performComponentFromObjectDef(const QString &fileName, QmlJS::AST::UiObject
{
QmlJSRefactoringChanges refactoring(QmlJS::ModelManagerInterface::instance(),
QmlJS::ModelManagerInterface::instance()->snapshot());
QmlJSRefactoringFilePtr current = refactoring.file(fileName);
QmlJSRefactoringFilePtr current = refactoring.file(Utils::FilePath::fromString(fileName));
QmlJSQuickFixInterface interface;
Operation operation(interface, objDef);

View File

@@ -56,7 +56,7 @@ void QmlJSQuickFixOperation::perform()
{
QmlJSRefactoringChanges refactoring(ModelManagerInterface::instance(),
m_interface->semanticInfo().snapshot);
QmlJSRefactoringFilePtr current = refactoring.file(fileName());
QmlJSRefactoringFilePtr current = refactoring.file(Utils::FilePath::fromString(fileName()));
performChanges(current, refactoring);
}

View File

@@ -880,7 +880,8 @@ 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());
TextEditor::RefactoringFilePtr file = refactoring.file(
Utils::FilePath::fromString(m_semanticInfo.document->fileName()));
file->setChangeSet(changeSet);
foreach (const Utils::ChangeSet::Range &range, changedRanges) {
file->appendIndentRange(range);