aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/clangformat/clangformatconfigwidget.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Editor: add formatter supportDavid Schulz2020-01-221-1/+1
| | | | | Change-Id: I65590273b2541e08a39970cd9bb4739a5634b2f7 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Fix MSVC warningsOrgad Shaneh2019-09-111-3/+2
| | | | | | | | | | * Missing `this` captures * Implicit size_t -> int conversion * Unused argument * Suppress warnings in clang headers Change-Id: I7083ce6ab22ee22ecc1258539e77c790acc78df1 Reviewed-by: hjk <hjk@qt.io>
* Utils: Rename FileName to FilePathhjk2019-05-281-3/+3
| | | | | | | | More in line with QFileInfo terminonlogy which appears to be best-of-breed within Qt. Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* ExtensionSystem: Move away from QListEike Ziller2019-05-271-1/+1
| | | | | | | | Qt 6 API will move away from it. Use QVector for API and some std container for internal things. Change-Id: Iff14d48a47d5ac52ade875d9c8c84ad8a4f577d8 Reviewed-by: hjk <hjk@qt.io>
* More FileName::appendPath() -> .pathAppended() changeshjk2019-05-271-3/+3
| | | | | Change-Id: Ibc7eb4eb3ffb64658e441aafa240b1ddc0061930 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Some more FileName::appendPath() -> pathAppended() changeshjk2019-05-171-2/+2
| | | | | Change-Id: Ie494f7ae8a96d97c9497b3ef38d774d2cf787b7f Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* ClangFormat: Add the interaction with BeautifierIvan Donchevskii2019-04-291-0/+54
| | | | | | | | Do not allow ClangFormat plugin to format on file save when the Beautifier has the same checkbox selected. Change-Id: I655d77a888cc444ccb02c4e72f11a93b3ab9bbd5 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Do not reinitialize the configuration and previewIvan Donchevskii2019-04-291-23/+25
| | | | | | | Initialize them only once and only show/hide widgets later on. Change-Id: I5ebad504709e34aeb6ce5bf1ead7d8e2ee0b2056 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Fix compile with older gcc and MSVCChristian Stenger2019-04-291-1/+1
| | | | | | | Amends 2d8ce380c9f97. Change-Id: I44e7079ae40550e4d80a1717d4803d6864af99eb Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangFormat: Fix UI issuesIvan Donchevskii2019-04-261-78/+103
| | | | | | | | | | | - 'Default' values remain so after save/load - the language is fixed to C++ - the project settings are shown correctly - fix parsing configuration file - do not trigger slots when we fill the table Change-Id: I91b477721b5084803324cd38d0cfeb9d5650dd9f Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Improve the configuration UIIvan Donchevskii2019-04-251-22/+205
| | | | | | | | | | | | | Use QComboBox, QLineEdit and QPlainTextEdit to edit different option types. Show changes in the preview without pressing 'Apply' button. The clangformatchecks.ui file is generated with the python script that is a part of this commit. Change-Id: If5ff0acab6edd74f2e087e31fbd3ad1b9f847030 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Show the global fallback styleIvan Donchevskii2019-04-251-11/+9
| | | | | | Fixes: QTCREATORBUG-22144 Change-Id: I201dbccb8b1f1738451f760af34cf588afb5f4d5 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Disable configuration UI instead of hidingIvan Donchevskii2019-04-031-5/+11
| | | | | | | | This is the first step without strings change. The next step is I201dbccb8b1f1738451f760af34cf588afb5f4d5. Change-Id: Ic0ce6a5ab3e74303a71a7c0bd8188d0284a241eb Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Fix showing the warning textIvan Donchevskii2019-04-021-0/+1
| | | | | | | The call to show() was lost at some point, let's restore it. Change-Id: I83f551d26e6c4f658426b1196ff3a0935aea7047 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Fix path for the overridden project configurationIvan Donchevskii2019-03-061-1/+2
| | | | | Change-Id: I4748c994016851293a6ad5490208fb4e4bbc7999 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Do not save settings if they are not overriddenIvan Donchevskii2019-03-061-0/+3
| | | | | | | Apply only settings from checkboxes in that case. Change-Id: Ic6740ab9d769730bba4d04dcdde7ad1e2a464614 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Change the logic how configuration is pickedIvan Donchevskii2019-03-051-34/+49
| | | | | | | | | | | | | | 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>
* CppTools: Move code style snippets to a separate headerOrgad Shaneh2019-02-261-1/+1
| | | | | | | | | Include it only where used. Resolves many "unused static variable" warnings. Change-Id: Ie1e578d9b9511f963e359d87f7740b4981975dbd Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* ClangFormat: Add the preview text editor to the settingsIvan Donchevskii2019-02-221-0/+35
| | | | | | | | | Allows the user to see how the current style applies to the code snippet. The action is triggered by the 'Apply' button. Change-Id: I820d989519cfdfb6e617ed6e8e9e5751be6619ea Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* ClangFormat: Show .clang-format file as text instead of the tableIvan Donchevskii2019-02-221-77/+8
| | | | | Change-Id: I8b912ec6f29dfe7059ac6ab3888a6c3698769fc1 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Fix handling more complex stylesIvan Donchevskii2019-02-221-6/+0
| | | | | Change-Id: I8c30c90a81bef786cdd0946351bf2cf46cc906ee Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Warn about invalid option and restore the last styleIvan Donchevskii2019-02-221-0/+12
| | | | | | | | 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>
* ClangFormat: Format edited chunks of file on saveIvan Donchevskii2019-02-051-1/+5
| | | | | | | | | | | | | 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>
* ClangFormat: Format more code while typingIvan Donchevskii2019-02-051-3/+18
| | | | | | | | | | | | | | | 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>
* ClangFormat: Introduce check to format code instead of indentingIvan Donchevskii2019-01-311-0/+10
| | | | | | | | | 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>
* ClangFormat: Fix applying global settingsIvan Donchevskii2019-01-241-5/+8
| | | | | | | The actual apply() method was never called for the widget. Change-Id: Idff194a36591db437cbe5695377005ed5a0b25d4 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* ClangFormat: Remove unused variableNikolai Kosjar2018-12-051-1/+1
| | | | | Change-Id: Iaaf0e1f34d76842b82827be4079ffd666755ab5b Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* ClangFormat: Move settings to the Code Style widgetIvan Donchevskii2018-12-041-1/+6
| | | | | | | | | | | | | | | 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>
* ClangFormat: Use relevant settings for each fileIvan Donchevskii2018-11-141-3/+2
| | | | | | | | | | | | | 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>
* ClangFormat: Use the constant for the configuration filenameIvan Donchevskii2018-11-131-4/+5
| | | | | | | | 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>
* ClangFormat: Synchronize with C++ code style settingsIvan Donchevskii2018-11-081-22/+6
| | | | | | | | | 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>
* Clang: Remove superfluous white spaceRobert Loehning2018-10-241-1/+1
| | | | | | Change-Id: I4a37e18ca18c673ab5d0906ebb59823baa1b2879 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Significantly improve ClangFormat plugin usabilityIvan Donchevskii2018-10-171-42/+51
| | | | | | | | | | | | 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>
* ClangFormat: Fix warning about initialization orderTobias Hunger2018-09-121-1/+1
| | | | | Change-Id: I83858454b5654924be502b249d3b355af7aab1b8 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Use clang-format for indentationIvan Donchevskii2018-09-121-0/+205
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>