Commit Graph

9 Commits

Author SHA1 Message Date
Ivan Donchevskii
0e5c7f51fa ClangFormat: Synchronize with C++ code style settings
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>
2018-11-08 14:23:06 +00:00
Ivan Donchevskii
0a29e12d0c ClangFormat: Fix text indentation after inserted snippet
Limit the range of text which is indented to the last
non-empty character inside the block.

Fixes: QTCREATORBUG-21385
Change-Id: If9bc271e7ecf81482cb682efd0f09770e6fa02f5
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-11-08 14:19:01 +00:00
Ivan Donchevskii
918713a059 ClangFormat: Make more readable helper functions
Change-Id: I25828a17104a778d4be156bf2a2879cefbd08691
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-10-24 12:23:49 +00:00
Ivan Donchevskii
cafd5ced1a Clang: Significantly improve ClangFormat plugin usability
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>
2018-10-17 07:16:04 +00:00
Ivan Donchevskii
e0d7d03720 Clang: Fix ClangFormat build with clang-7
Change-Id: I0859b7aad1a49f8d46ee4b32cc32039cfa0b482b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-10-05 11:08:27 +00:00
Tobias Hunger
74813fba3a ClangFormat: Fix unused parameter warning
Change-Id: Ib2d46e88a236a8ac7706a9827535b664e9f08792
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-09-12 13:58:40 +00:00
Tobias Hunger
a5f63f4aa0 ClangFormat: Fix warnings about signed/unsigned int
Change-Id: I5cff5054d3440ee6fb0f262e6306ae525afa94c9
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-09-12 13:58:33 +00:00
Tobias Hunger
5462527c0d ClangFormat: Fix warnings about fallthrough
Change-Id: Iaa2effe38153844552e2b1baa9d9d5336ed886ab
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-09-12 13:58:06 +00:00
Ivan Donchevskii
ca84a51f86 Clang: Use clang-format for indentation
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>
2018-09-12 07:59:30 +00:00