forked from qt-creator/qt-creator
ClangFormat: Improve current style detection
Check first if the current project already has .clang-format configuration file. Change-Id: Ic8cb5d37c32cd5b0c04485589caea95de933c264 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -172,10 +172,17 @@ clang::format::FormatStyle currentGlobalStyle()
|
|||||||
return currentStyle(true);
|
return currentStyle(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isCurrentStyleGlobal()
|
||||||
|
{
|
||||||
|
Utils::FileName path = projectStylePath();
|
||||||
|
if (path.appendPath(".clang-format").exists())
|
||||||
|
return false;
|
||||||
|
return !CppCodeStyleSettings::currentProjectCodeStyle().has_value();
|
||||||
|
}
|
||||||
|
|
||||||
clang::format::FormatStyle currentStyle()
|
clang::format::FormatStyle currentStyle()
|
||||||
{
|
{
|
||||||
const bool isGlobal = !CppCodeStyleSettings::currentProjectCodeStyle().has_value();
|
return currentStyle(isCurrentStyleGlobal());
|
||||||
return currentStyle(isGlobal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user