forked from qt-creator/qt-creator
CppEditor: Enable formatting for "apply signature changes" action
So that the changes done by our internal rewriter get properly formatted afterwards by ClangFormat (if enabled). Fixes: QTCREATORBUG-31104 Change-Id: I4066ef56a765a8f2c2542b4f9220f1857d013624 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -271,7 +271,12 @@ void FunctionDeclDefLink::apply(CppEditorWidget *editor, bool jumpToMatch)
|
|||||||
const int jumpTarget = newTargetFile->position(targetFunction->line(), targetFunction->column());
|
const int jumpTarget = newTargetFile->position(targetFunction->line(), targetFunction->column());
|
||||||
newTargetFile->setOpenEditor(true, jumpTarget);
|
newTargetFile->setOpenEditor(true, jumpTarget);
|
||||||
}
|
}
|
||||||
newTargetFile->apply(changes(snapshot, targetStart));
|
ChangeSet changeSet = changes(snapshot, targetStart);
|
||||||
|
for (ChangeSet::EditOp &op : changeSet.operationList()) {
|
||||||
|
if (op.type() == ChangeSet::EditOp::Replace)
|
||||||
|
op.setFormat1(true);
|
||||||
|
}
|
||||||
|
newTargetFile->apply(changeSet);
|
||||||
} else {
|
} else {
|
||||||
ToolTip::show(editor->toolTipPosition(linkSelection),
|
ToolTip::show(editor->toolTipPosition(linkSelection),
|
||||||
Tr::tr("Target file was changed, could not apply changes"));
|
Tr::tr("Target file was changed, could not apply changes"));
|
||||||
|
@@ -357,6 +357,7 @@ void RefactoringFile::doFormatting()
|
|||||||
indenterOwner.reset(factory ? factory->createIndenter(document)
|
indenterOwner.reset(factory ? factory->createIndenter(document)
|
||||||
: new PlainTextIndenter(document));
|
: new PlainTextIndenter(document));
|
||||||
indenter = indenterOwner.get();
|
indenter = indenterOwner.get();
|
||||||
|
indenter->setFileName(filePath());
|
||||||
tabSettings = TabSettings::settingsForFile(filePath());
|
tabSettings = TabSettings::settingsForFile(filePath());
|
||||||
}
|
}
|
||||||
QTC_ASSERT(document, return);
|
QTC_ASSERT(document, return);
|
||||||
|
Reference in New Issue
Block a user