TextEditor: Optionally auto-save refactored files

This is particularly helpful with clangd, which considers only the on-
disk state of header files when parsing dependent sources.

Fixes: QTCREATORBUG-25924
Change-Id: I41d313f8a203a576d3ed5fbe75bbe918334486d4
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-08-17 17:59:51 +02:00
parent 3d920bc000
commit 35fcd96b85
6 changed files with 283 additions and 241 deletions

View File

@@ -126,6 +126,10 @@ public:
"a crash or power failure, it asks whether to "
"recover the auto-saved content.")
.arg(Constants::IDE_DISPLAY_NAME));
m_ui.autoSaveRefactoringCheckBox->setChecked(EditorManager::autoSaveAfterRefactoring());
m_ui.autoSaveRefactoringCheckBox->setToolTip(tr("Automatically saves all open files "
"affected by a refactoring operation,\n provided they were unmodified before the "
"refactoring."));
m_ui.autoSaveInterval->setValue(EditorManagerPrivate::autoSaveInterval());
m_ui.autoSuspendCheckBox->setChecked(EditorManagerPrivate::autoSuspendEnabled());
m_ui.autoSuspendMinDocumentCount->setValue(EditorManagerPrivate::autoSuspendMinDocumentCount());
@@ -268,6 +272,8 @@ void SystemSettingsWidget::apply()
PatchTool::setPatchCommand(m_ui.patchChooser->filePath());
EditorManagerPrivate::setAutoSaveEnabled(m_ui.autoSaveCheckBox->isChecked());
EditorManagerPrivate::setAutoSaveInterval(m_ui.autoSaveInterval->value());
EditorManagerPrivate::setAutoSaveAfterRefactoring(
m_ui.autoSaveRefactoringCheckBox->isChecked());
EditorManagerPrivate::setAutoSuspendEnabled(m_ui.autoSuspendCheckBox->isChecked());
EditorManagerPrivate::setAutoSuspendMinDocumentCount(m_ui.autoSuspendMinDocumentCount->value());
EditorManagerPrivate::setWarnBeforeOpeningBigFilesEnabled(