We've searched for the config we want to use but did not change
the path for the source file which is used internally by libformat
to find the configuration.
Fixes: QTCREATORBUG-22048
Change-Id: Ibdcc33ac338f06e966dfc5c06cdb38db3bb768b6
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Add the context menu item to C++ editor which allow you to open
the currently used .clang-format configuration file.
Change-Id: If9d6bec4f4085c18b13df15d78417aee82ddb4e4
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
If there is a .clang-format file in the project use it as
a base for the custom file that creator uses to override
the project settings.
Change-Id: I0786dbdd6077b87d4dd428981e24d503668f1031
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Let's use by default the configuration that clang-format picks itself
for the source file. The Qt Creator configuration will now only
override the default one with global or project settings and can be
turned off with the checkbox.
This behavior is clearer than always picking some configuration
which Qt Creator prefers best.
Change-Id: If5ed3d67eb6b4b47a6d0fd5259f7efbb608914d1
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
1. Fallback to the base style from the invalid config file:
If the .clang-format file from the earlier clang version is used
and can't be parsed by LibFormat try to find a base style and
generate the updated config based on that information.
2. Do not create new .clang-format configuration for each project.
Rely on the global one until the user explicitly creates the
configuration for the project.
Fixes: QTCREATORBUG-22004
Change-Id: I75bd89eebc3ebae57c1f1de94da2e78924ae510c
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
The actual apply() method was never called for the widget.
Change-Id: Idff194a36591db437cbe5695377005ed5a0b25d4
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Existing Clang Format settings may not follow the
project/global pattern but can be expected to be used
for the indentation/formatting.
So let's proceed with UI for global/project settings
but use global settings only if there's no configuration
found for the current file.
Change-Id: I87c25ab3feb7e2e3deb0290848088657783cf972
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
It is unlikely that this name changes but let's follow good
coding practices.
Change-Id: I12adbf155f26b1b3a02d07092fcc113e0c5157e6
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Check first if the current project already has .clang-format
configuration file.
Change-Id: Ic8cb5d37c32cd5b0c04485589caea95de933c264
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
If it's not set to custom some user settings are
continuously overridden which is not always expected.
Previously the default style caused some parameters
to be reset.
Change-Id: Ie0fedf6b9984116a86b7c588aed8c6b6cb35133e
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
The calling code can anyways fallback to the global style
without extra help if no project style exists.
It is useful when you want to get the project style if it exists
and understand at the same time that it is not a global one.
Change-Id: I265de3f436f90623385427fc8a1abad09c8c3577
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
And remove UI for default code style settings because
it does not affect anything when ClangFormat plugin is
enabled.
Change-Id: Ie348b7d2691b09ea2b4868da987f2a27347ea0f3
Reviewed-by: Marco Bubke <marco.bubke@qt.io>