aboutsummaryrefslogtreecommitdiffstats
path: root/dist/clangformat
Commit message (Collapse)AuthorAgeFilesLines
* Clang: Use clang-format for indentationIvan Donchevskii2018-09-122-133/+4
| | | | | | | | | | | | | | | | | | | 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>
* Beautifier: ClangFormat: Format current syntactic entity for no selectionNikolai Kosjar2017-09-211-1/+1
| | | | | | | | | | | | | | | | In case there was no selection, the action "Format Selected Text" could format the whole file (option) as a fallback. However, there is also the use case of formatting the syntactic entity under the cursor. Introducing another separate action for this feels wrong, so remove the fallback instead since there is already an action handling this. Change-Id: Ia73f6074433e706bb4c2d375ad5b84dd59bc93a3 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Lorenz Haas <lorenz.haas@histomatics.de>
* Beautifier: ClangFormat: Add action "Disable Formatting for Selected Text"Nikolai Kosjar2017-09-211-0/+1
| | | | | | | | Change-Id: I0786dfdc0679bbdf1cf1157067bd7f572ac7d108 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Lorenz Haas <lorenz.haas@histomatics.de>
* Add experimental .clang-formatNikolai Kosjar2017-09-042-0/+271
This adds a configuration file for clang-format [1] and a test file to demonstrate benefits and current problems with respect to Qt Creator's coding rules [2]. This is based on clang-format from the llvm/clang 5.0 branch, which is about to be released soon in the next days/weeks (already behind schedule). Using clang-format for Qt Creator brings these advantages: * Enforce a bunch of coding rules by a simple tool/shortcut invocation. * Spend less review cycles for authors and reviewers regarding formatting. This helps especially for/with first-time contributors. * clang-format sorts includes and using declarations. * clang-format adds/updates namespace end comments, e.g.: } // namespace Foo See dist/clangformat/README.md for setup instructions und currently known issues. [1] https://clang.llvm.org/docs/ClangFormat.html [2] https://doc-snapshots.qt.io/qtcreator-extending/coding-style.html Task-number: QTCREATORBUG-17643 Change-Id: I87bdd66b8e492e99a360022962b0053f02a33e57 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>