summaryrefslogtreecommitdiff
path: root/src/plugins/clangformat/clangformatplugin.cpp
Commit message (Collapse)AuthorAgeFilesLines
* ClangFormat: Grey out Clang-Format Style config when not overriddenArtem Sokolovskii2023-04-061-2/+2
| | | | | | | | | Add feature to grey out the Clang-Format Style configuration widget after unchecking the 'Override' checkbox. Change-Id: I94bbb1f4436f3caeaed55d49582211257e480d0d Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Clang*: Use new plugin test setup schemehjk2023-02-151-7/+2
| | | | | Change-Id: I636b93d74b4f9ab9ade28c46c6e84b461ccf34be Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* ClangFormat: Fix buildAlessandro Portale2023-02-081-0/+1
| | | | | Change-Id: I6197429ddd0aa10631d1ecbecd25154045a7004f Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* ClangFormat: Tr::tr()Alessandro Portale2023-02-081-3/+2
| | | | | Change-Id: Iabbe39bfdd3ae24d65610a00d792e16591a1b6ee Reviewed-by: hjk <hjk@qt.io>
* ClangFormatPlugin: Don't leak ClangFormatStyleFactoryJarek Kobus2023-02-061-36/+14
| | | | | | | | Detected by memory analyzer. Remove unneeded includes. Change-Id: I270b8a6f1d98fc25297b1f69e899551399437cf0 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Use simpler Plugin::initialize() when feasiblehjk2023-01-201-4/+1
| | | | | Change-Id: I567965d266f20526bda9f823e31a04b354d53fb1 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* ClangFormat: Fix the "Open Used .clang-format File" functionArtem Sokolovskii2023-01-201-1/+1
| | | | | | | | | | - FilePathify related functions - Logic of related functions were updated to use new configuration files location and new settings variables Change-Id: I9f5504fc72f5c051a83dc80e1feb2e13272de146 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Remove GPL-3.0+ from license identifiersKai Köhne2023-01-061-1/+1
| | | | | | | | | | | | | | | Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0, this applies only to a hypothetical newer version of GPL, that doesn't exist yet. If such a version emerges, we can still decide to relicense... While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only Change was done by running find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \; Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* ClangFormat: Enable plugin by defaultChristian Kandeler2022-12-161-19/+0
| | | | | | | | | | | | | | | ... and remove the compile- and run-time warnings. Users can easily opt out of using clang-format via the settings dialog these days (globally and per project), so loading the plugin does no harm. As of b88b73d9c1b9fb4c1da4ab8ad85fbcad05512668, clang formatting should work without our custom patch, so there is no need to warn against that either. Change-Id: I5336857c6e27d9162084c2dacf187acb0015dc6a Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* ClangFormat: Make formatting mode a project optionArtem Sokolovskii2022-12-151-3/+1
| | | | | | | | | | - Added the possibility to set formatting mode for every project separately. The indenter will be switched for a file if the mode changes. Fixes: QTCREATORBUG-28188 Change-Id: I4e7f9841c54f9b6763586c16672a10ca36bf843d Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* ClangTools: Pass context object to lambda connectionsJarek Kobus2022-12-081-1/+1
| | | | | | | | | Remove some unneeded lambda () brackets. Change-Id: I502eb5cd89505fb77c02abf44b7ce19541a8ac2f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* ClangFormat: Add missing overrideEike Ziller2022-09-071-1/+1
| | | | | | | Change-Id: I8ed5918471935d21ae7036081cc45d6430c295d2 Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Use SPDX license identifiersLucie Gérard2022-08-261-24/+2
| | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Task-number: QTBUG-67283 Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* ClangFormat: Move global settings in main pageArtem Sokolovskii2022-08-051-0/+7
| | | | | | | | | The settings: indenting instead formatting, format while typing, format edited on file save are moved to Code Style page. Change-Id: I28787b44602ce288961c778fe704ad2a1a05913f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* ClangFormat: Add disable optionArtem Sokolovskii2022-05-191-0/+4
| | | | | | | | - Added a possibility to disable ClangFormat plugin - Removed unneeded properties from clangformatsettings Change-Id: If71f46670e4fd3d2dac6d18c97df5a811504ed5e Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Merge remote-tracking branch 'origin/7.0'Eike Ziller2022-05-101-5/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/clangformat/clangformatconfigwidget.cpp src/plugins/clangformat/clangformatplugin.cpp src/plugins/cppeditor/cppcodestylepreferencesfactory.cpp src/plugins/cppeditor/cppcodestylepreferencesfactory.h src/plugins/nim/settings/nimcodestylepreferencesfactory.cpp src/plugins/nim/settings/nimcodestylepreferencesfactory.h src/plugins/qmljstools/qmljscodestylepreferencesfactory.cpp src/plugins/qmljstools/qmljscodestylepreferencesfactory.h src/plugins/texteditor/codestyleselectorwidget.cpp src/plugins/texteditor/icodestylepreferencesfactory.h Change-Id: I20ee430a7f0085774c9df1aa5487046ba4f404c1
| * ClangFormat: Fix settings checkboxes disappearanceArtem Sokolovskii2022-05-101-4/+3
| | | | | | | | | | | | | | | | | | | | - Fixed settings checkboxes disappearance after open a project - Fixed impossibility to save settings Task-number: QTCREATORBUG-26948 Change-Id: Ia73a61bf56b99adea9ed45c9d656860b185a3d7e Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | ClangFormat: Add the logical settings managementArtem Sokolovskii2022-04-111-3/+5
|/ | | | | | | | | | | | | | Now there are changeable and unchangeable settings, as it works for usual codestyle settings. They save parallel with codestyle settings but in another dir. In general, the behavior became similar to usual codestyle settings. ToDo: Make indenter use this settings instead standard one and instead project settings when "override" checkbox is checked. Change-Id: I639dbda296932bf9b967a11f1cc4fda120415ed9 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* ClangFormat: Move tests into pluginChristian Kandeler2022-01-201-0/+10
| | | | | | | | | That's where they belong Change-Id: I78e33e76a2f42f05961f6fab31da5f3dd583a2e9 Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* ClangFormat: Synchronize ClangFormat settings with CppEditor codestyleArtem Sokolovskii2021-11-241-1/+2
| | | | | | | | | | | Added synchronization between ClangFormat codestyle settings and CppEditors codestyle settings. All changes which will be done in ClangFormat settings tab settings tabs will be automatically retranslated to CppEditor codestyle settings tabs and vice versa. Change-Id: I408d726c12552856e3c1b72d3ba09b77fff83321 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* EditorManager: Remove QString openEditor(At) overloadsEike Ziller2021-11-021-1/+1
| | | | | | | | In favor of the FilePath/Link ones. Change-Id: I5caf9e0f8de304ff4ee12329557aa50a6f3a0c69 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangFormat: Move ClangFormat settings pageArtem Sokolovskii2021-10-081-13/+7
| | | | | | | | - Move ClangFormat settings page to TabWidget in the dialog that opens when a user press "Edit" button in the CodeStyle tab Change-Id: Ibd285344f07a6b2b20e275f2134976c50f91a019 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Merge CppTools into CppEditorChristian Kandeler2021-09-011-5/+5
| | | | | | | | | | | | | | | | There was no proper separation of responsibilities between these plugins. In particular, CppTools had lots of editor-related functionality, so it's not clear why it was separated out in the first place. In fact, for a lot of code, it seemed quite arbitrary where it was put (just one example: switchHeaderSource() was in CppTools, wheras switchDeclarationDefinition() was in CppEditor). Merging the plugins will enable us to get rid of various convoluted pseudo-abstractions that were only introduced to keep up the artificial separation. Change-Id: Iafc3bce625b4794f6d4aa03df6cddc7f2d26716a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* ClangFormat: Code cosmeticshjk2021-08-171-29/+23
| | | | | Change-Id: I2aa83d4121a2c255547e14a32b0fe4bfd11dc72b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* ClangFormat: Fix missing return value warningChristian Stenger2021-01-071-1/+1
| | | | | | | Amends f7d8f8b7048. Change-Id: I3e509769a8ef206f295b3b5d8db4448375e62cbb Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* ClangFormat: Do not refuse to build against unpatched clangChristian Kandeler2021-01-061-11/+16
| | | | | | | | | The plugin builds just fine and should be mostly (fully?) functional with upstream clang, so it seems excessive to force-disable it entirely for everybody not using our custom patch. Change-Id: Id6a179c20325290a8205218c9514a16c1adc9076 Reviewed-by: hjk <hjk@qt.io>
* ClangFormat: Fix warningMarco Bubke2020-06-151-0/+5
| | | | | Change-Id: Ifdf4bfb7662017b2ba2e28074808919f7a726a8a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Remove apparently unneeded QtPlugin includeshjk2020-02-121-2/+0
| | | | | | Change-Id: I511c0318a72dbf2a92e4749dee02eabfc9826139 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Merge remote-tracking branch 'origin/4.10'Eike Ziller2019-09-171-2/+3
|\ | | | | | | Change-Id: I887fbf79ebfdf2af2719cb0d8aa56ab3dcb08fab
| * ClangFormat: improve the message the users seeLisandro Damián Nicanor Pérez Meyer2019-09-121-2/+3
| | | | | | | | | | | | | | | | In this way it's made clear that the plugin requires a patched version of Clang. Task-number: QTCREATORBUG-22923 Change-Id: Ifefd5ab1a3dc82b85e553c5e1fedffb72919dd17 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Merge remote-tracking branch 'origin/4.10'Eike Ziller2019-09-121-0/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | Conflicts: cmake/QtCreatorIDEBranding.cmake qbs/modules/qtc/qtc.qbs qtcreator_ide_branding.pri src/plugins/projectexplorer/gcctoolchain.cpp src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp Change-Id: Iffdf48e782a734107ea170ebb3812e997cea0e7b
| * Fix MSVC warningsOrgad Shaneh2019-09-111-0/+1
| | | | | | | | | | | | | | | | | | | | * Missing `this` captures * Implicit size_t -> int conversion * Unused argument * Suppress warnings in clang headers Change-Id: I7083ce6ab22ee22ecc1258539e77c790acc78df1 Reviewed-by: hjk <hjk@qt.io>
* | Fix compile after FileName dropChristian Stenger2019-07-241-1/+1
| | | | | | | | | | | | | | Amends 44acfc0702d0. Change-Id: I1bddb0642e181b0a02d4ecba7ff1ae282218338f Reviewed-by: hjk <hjk@qt.io>
* | Enable macro editing for the Clang indexerMarco Bubke2019-06-131-2/+2
|/ | | | | | | | Refactor much of the code from Environment* classes to NameValue* classes to share it with the preprocessor macro settings. Change-Id: Ica4ee817aa338230c422b30d91240d266248d226 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* ClangFormat: Provide an error message for Clang FormatMarco Bubke2019-06-111-1/+6
| | | | | | | | | | If an patch is not applied to libFormat in Clang we do nothing. It would be better to provide feedback if the plugin is loaded. Change-Id: Iea9900cf7683b521497cc6403638498a9ca5e2e9 Fixes: QTCREATORBUG-22404 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* Merge remote-tracking branch 'origin/4.9'Eike Ziller2019-03-141-3/+52
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qbs/modules/qtc/qtc.qbs qtcreator.pri src/plugins/debugger/debuggerkitinformation.cpp src/plugins/languageclient/languageclientmanager.cpp src/plugins/plugins.pro src/plugins/projectexplorer/kit.cpp src/plugins/projectexplorer/kitmanager.cpp Change-Id: I66fb941202991f35f7d7761430b21e42dfc678a8
| * ClangFormat: Add context menu item to open current config fileIvan Donchevskii2019-03-071-3/+52
| | | | | | | | | | | | | | | | | | 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>
* | Plugins: Code cosmeticshjk2019-02-271-3/+0
|/ | | | | | | | | Get closer to a uniform pattern of code layout (public/private, pimpl naming...) Change-Id: If2bc6dcee3df9127274f479b4ebc270d283dcb65 Reviewed-by: Xing Xiong Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* ClangFormat: Fix applying global settingsIvan Donchevskii2019-01-241-2/+3
| | | | | | | The actual apply() method was never called for the widget. Change-Id: Idff194a36591db437cbe5695377005ed5a0b25d4 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* ClangFormat: Refactor indenter to allow ClangFormat unit-testsIvan Donchevskii2019-01-221-2/+2
| | | | | | | | | | We do not build texteditor files in unit-tests so some tricks were required to make ClangFormatIndenter available. First simple unit-test proofs it builds and runs. Change-Id: I81d5ea099bd27fd1c1ed8b5b7877299dcc62a67f Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* ClangFormat: Move settings to the Code Style widgetIvan Donchevskii2018-12-041-55/+21
| | | | | | | | | | | | | | | 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: Fix unused static function warningOrgad Shaneh2018-11-091-0/+2
| | | | | | | Amends commit 0e5c7f51fa88f8df0061ae6c8e43a7a0e143d552. Change-Id: I4beb8219828cbf7d02677e724bee41abdf0d7fef Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* ClangFormat: Synchronize with C++ code style settingsIvan Donchevskii2018-11-081-0/+24
| | | | | | | | | 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: Significantly improve ClangFormat plugin usabilityIvan Donchevskii2018-10-171-4/+4
| | | | | | | | | | | | 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>
* Clang: Use clang-format for indentationIvan Donchevskii2018-09-121-0/+120
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>