forked from qt-creator/qt-creator
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:
@@ -342,6 +342,7 @@ bool RefactoringFile::apply()
|
||||
m_editorCursorPosition = -1;
|
||||
}
|
||||
|
||||
const bool withUnmodifiedEditor = m_editor && !m_editor->textDocument()->isModified();
|
||||
bool result = true;
|
||||
|
||||
// apply changes, if any
|
||||
@@ -390,6 +391,8 @@ bool RefactoringFile::apply()
|
||||
}
|
||||
|
||||
fileChanged();
|
||||
if (withUnmodifiedEditor && EditorManager::autoSaveAfterRefactoring())
|
||||
m_editor->textDocument()->save(nullptr, m_filePath, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user