Do not save the configuration which contains errors.
Change-Id: I050b22f7e589e5c39909fe1f611e56ead03d49ee
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
The similar implementation to the one in Beautifier plugin
with the difference that the clangformat indenter logic is used
and only modified chunks are formatted.
That means that all code which was not touched will stay in the
initial condition.
Change-Id: I47b11eb99852454ed0031ef6cfc6dbed1ecd390d
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
With the extra option "Format while typing" checked try to format
text before the current position without breaking the current input.
To accomplish that we make proper choices which replacements to apply.
The advantage of this change is to decrease the need to manually
format code which is just written.
Some minor bugs are fixed during the testing of this change.
Change-Id: Ibed569042e6c46a881e7a83b1882cf2bb23b3626
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Ctrl+I with the new check will reformat the selected code or
the current line instead.
Change-Id: Ia5a72c4a09621034d0dfe463f669fe1ca36b0b5f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
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>
It makes sense to unify the indenter creation by replacing
the CppCodeStylePreferencesFactory instead of removing it.
We are reusing the same options page but with different
kind of settings.
With this change wizards will no more be confused by missing
factory and will create the proper indenter.
Fixes: QTCREATORBUG-21516
Change-Id: I38964d5fa1f2257617c66a1441db723d239a3237
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
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>
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>
What's new:
1. New LibFormat option is used to prevent lines shrink,
which allows to drop most of tricks used before for that purpose.
2. Cached UTF-8 source code is used to improve performance
3. Improved error handling.
4. Slightly improved UI.
Change-Id: I4605200fa103167369a40650b2e1ad2c61e8133b
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This is the new experimental plugin based on LibFormat.
It replaces the default indenter for CppEditorDocument
and applies clang-format after the CR or the set of 'electric'
characters.
Uses the global .clang-format kept in QtC settings or
the one for current project. Both can be configured.
For indentation some style modifications and code manipulations
are done to prevent line shrinking when it's not expected.
Manual indentation uses unmodified style from .clang-format file.
Change-Id: I6279b805e418e1804b553efa615f5c843f395a58
Reviewed-by: Marco Bubke <marco.bubke@qt.io>