forked from qt-creator/qt-creator
ClangFormat: Fix preview update
Fixes: QTCREATORBUG-30089 Change-Id: Id89e8b2ee0439c5235755256e8410f42ad94b432 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -782,7 +782,8 @@ void ClangFormatBaseIndenter::autoIndent(const QTextCursor &cursor,
|
||||
}
|
||||
}
|
||||
|
||||
clang::format::FormatStyle overrideStyle(const Utils::FilePath &fileName)
|
||||
clang::format::FormatStyle ClangFormatBaseIndenter::overrideStyle(
|
||||
const Utils::FilePath &fileName) const
|
||||
{
|
||||
const ProjectExplorer::Project *projectForFile
|
||||
= ProjectExplorer::ProjectManager::projectForFile(fileName);
|
||||
@@ -792,6 +793,9 @@ clang::format::FormatStyle overrideStyle(const Utils::FilePath &fileName)
|
||||
? projectForFile->editorConfiguration()->codeStyle("Cpp")->currentPreferences()
|
||||
: TextEditor::TextEditorSettings::codeStyle("Cpp")->currentPreferences();
|
||||
|
||||
if (m_overriddenPreferences)
|
||||
preferences = m_overriddenPreferences->currentPreferences();
|
||||
|
||||
Utils::FilePath filePath = filePathToCurrentSettings(preferences);
|
||||
|
||||
if (!filePath.exists())
|
||||
@@ -854,4 +858,9 @@ const clang::format::FormatStyle &ClangFormatBaseIndenter::styleForFile() const
|
||||
return m_cachedStyle.style;
|
||||
}
|
||||
|
||||
void ClangFormatBaseIndenter::setOverriddenPreferences(TextEditor::ICodeStylePreferences *preferences)
|
||||
{
|
||||
m_overriddenPreferences = preferences;
|
||||
}
|
||||
|
||||
} // namespace ClangFormat
|
||||
|
||||
Reference in New Issue
Block a user