Commit Graph

58 Commits

Author SHA1 Message Date
Eike Ziller
7f5876b45a Merge remote-tracking branch 'origin/10.0'
Change-Id: I98e5e1ad43103984b490c65cdeed84b7414303b3
2023-05-11 10:33:18 +02:00
Artem Sokolovskii
7960c1f3f6 ClangFormat: Fix code style preferences are grayed out
Code style preferences are grayed out even when formatting mode
is set to disable.

Fixes: QTCREATORBUG-29129
Change-Id: Icf82fa0751f9291122c2af55111b6bd5fac85c7b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-05-11 08:11:54 +00:00
Eike Ziller
7724f8653f Merge remote-tracking branch 'origin/10.0'
Change-Id: I7a3925ad8e4f97461b64a70217102ed900430253
2023-05-05 10:39:47 +02:00
Artem Sokolovskii
7c1f2ea16d ClangFormat: Fix autoindentation for QML_ and Q_ macros
Fixes: QTCREATORBUG-29086
Change-Id: Ie23e46baf2c802799818cb724aacd71776480b06
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-04-27 08:43:41 +00:00
Eike Ziller
c9696fbabb Merge remote-tracking branch 'origin/10.0'
Change-Id: I8b36c1812b61dbe08fe3e7930f950e6b8e8a7079
2023-04-24 08:52:35 +02:00
Artem Sokolovskii
178c0abbd3 ClangFormat: Fix preview updating
Fixed the behavior when the preview does not update when the Override
checkbox was not enabled initially. Currently, the preview is updating
when Override the checkbox is enabled.

Fixes: QTCREATORBUG-29043
Change-Id: I8a2a6f3cd5890b66d4bffd0c84aeafb5a29fba48
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-04-18 11:21:58 +00:00
Eike Ziller
4e6877753a Merge remote-tracking branch 'origin/10.0'
Conflicts:
	src/plugins/android/androidrunnerworker.cpp
	src/plugins/qtsupport/exampleslistmodel.cpp

Change-Id: I1628528dbc0ffe874b49bbe022da5933b1348057
2023-04-18 12:53:45 +02:00
Artem Sokolovskii
0c37fc356e ClangFormat: Fix wrong indentation numbers with separator
Fixes: QTCREATORBUG-29033
Change-Id: I70ba12828d3805cb8087a797d14e0ee24611418f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-04-18 10:07:35 +00:00
hjk
3e7d93c788 ProjectExplorer: Move some not-fully-session related bits
... out of SessionManager.

The idea is to later move SessionManager into the Core plugin,
which both is sensible conceptually and also prerequisite to
merge the Bookmark plugin into TextEditor plugin.

Currently, only the interface is split, as the load/save
implemetations are non-mechanical to disentangle.

Change-Id: I31631db3094ea192825a2ccaa6add6188662940b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-03-01 09:26:50 +00:00
Christian Stenger
e20bdfae4d ClangFormat: Adapt to changes in LLVM 16
Change-Id: Ia4a2cf21e351095609d8858f1f9355c6607470f3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-01-31 13:17:58 +00:00
Artem Sokolovskii
a20c4c4490 ClangFormat: Fix the "Open Used .clang-format File" function
- 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>
2023-01-20 10:29:51 +00:00
Artem Sokolovskii
42c3e88f95 ClangFormat: Move the functions from clangformatutils
- Moved the functions from clangformatutils to the places where
it is belong

Change-Id: Ia4108c5b096610170e0f9d16d15d40d5538ffbdc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-01-17 09:00:56 +00:00
Artem Sokolovskii
5d9912b058 ClangFormat: Remov unused functions
Change-Id: I294e190cdd76467cb79b58bc818a240cdead8bbc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-01-16 14:22:49 +00:00
Artem Sokolovskii
34638aa497 ClangFormat: Add use global settings check box for a project
Change-Id: Ie2872de3574aaad058a9fca17247db00e9559ba7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-01-13 12:55:42 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
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>
2023-01-06 11:15:13 +00:00
Björn Schäpers
f4545807de clang-format: Adapt to LLVM 16
Change-Id: I2e35f92db6de10b1e4bf173f0864f0cd893a011f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-06 18:56:32 +00:00
Eike Ziller
6becc304b8 Fix compiler warnings
- private field 'm_postId' is not used
- private field 'm_hostChecked' is not used
- missing field 'AcrossEmptyLines' initializer

Change-Id: I1e31c79e078bcb68d053202ad322299b92c4fa38
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-10-13 13:13:07 +00:00
Björn Schäpers
a1bfcbf30d ClangFormat: Fix compilation with LLVM 15
Change-Id: I7990e8331c317d3bc363be610b2585d37dee4445
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-09-02 09:40:41 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
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>
2022-08-26 12:27:18 +00:00
Cristian Adam
c7cdd55dea ClangFormat: Fix build for LLVM 15.0.0
This fixes the CMake build of Qt Creator against LLVM 15.0.0

Change-Id: Icecd45821091c8c2b565246cb17ce5a6e5c49f36
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-08-18 09:43:30 +00:00
Artem Sokolovskii
72dd90e512 ClangFormat: Start to use new file management
- Indenter uses .clang-format file from a dir of
editing file or from a parent dir. If there is no
such file then indenter starts to use file from a dir
with the name current CodeStyle settings.
- Test fixed

ToDo: Add file absentness processing in case of import

Change-Id: If09ef0c598899856b948c214e524bcfd5dad76e2
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-04-20 07:52:17 +00:00
Artem Sokolovskii
7574ec3e21 ClangFormat: Add the logical settings management
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>
2022-04-11 14:03:22 +00:00
Christian Kandeler
b97c9494af ClangFormat: Adapt to LLVM 15 API change
Task-number: QTCREATORBUG-27170
Change-Id: I3676792da351f52199b1bf303c596e581469d7a5
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-25 13:36:50 +00:00
Artem Sokolovskii
72991ea5c1 [ClangFormat] Fix bax with BasedOnStyle field
Behavior was: The field became "LLVM" after a change to another style.
Fixed behavior: BasedOnStyle field becomes and stays chosen style.

Change-Id: I0d41a216f7f06c5681cc20a52c736406307a3724
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-03-03 13:26:40 +00:00
Artem Sokolovskii
ab5fdd94f3 [ClangFormat] Add test checkking indentation after Q_OBJECT
Added test checking behavior when after Q_OBJECT all class structure
have correct indenting and redundent tabs doesn't appear before key words
such as  public:, private: , etc.
Made automatic addition Qt defines to StatementMacro to .clang-format files.

Fixes: QTCREATORBUG-26776
Change-Id: I3490421a9caf2831b593939597940358f7ce8f01
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-02-10 13:37:05 +00:00
Christian Kandeler
284817fae6 Merge CppTools into CppEditor
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>
2021-09-01 14:53:58 +00:00
hjk
21b1bfc73c ClangFormat: Spread FilePath
Change-Id: Iedddd78b183b2290f98411e7c70807c1828f1c25
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-08-19 08:41:52 +00:00
Christian Kandeler
264fa85f50 Fix a number of compiler warnings
Change-Id: I3e71bffb2099d896742a6fca77febe20e2076464
Reviewed-by: hjk <hjk@qt.io>
2021-07-12 15:24:59 +00:00
Björn Schäpers
55b91a7617 clangformat: Fix build with LLVM 13
Change-Id: Ia9db10696fd129c8b989ecc4c9ecbb7f1f10e68c
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-17 10:17:38 +00:00
Christian Kandeler
b1dbeafd44 clang-format: Add more default statement macros
To prevent unwanted indentation of Qt code.

Change-Id: I9dac81c3bbda5e1e7635f93f096b49df9ee92265
Reviewed-by: hjk <hjk@qt.io>
2021-05-14 14:11:15 +00:00
Eike Ziller
c1f90aeca2 ICore: Change some path API to use FilePath
Change-Id: Id841d6177206a021c9e606ce560b47d1ae6e52b9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2021-04-26 08:03:47 +00:00
Christian Stenger
aa96b07853 ClangFormat: Fix compile
Amends 14eb5b382c.

Change-Id: I9bbd34d1d90d2cf27edd74037be5a3a061691456
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-11 12:11:18 +00:00
Björn Schäpers
14eb5b382c clangformat: Fix build with LLVM 13
Change-Id: I5eaad17a6f240aa1e3f246492b69f093b4f59fee
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-11 07:50:30 +00:00
Björn Schäpers
25e7b2c5d6 clangformat: Fix build with LLVM 12
Change-Id: I493afce92b16291cf66fc510129f2154a7162847
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-02-01 21:04:47 +00:00
Jarek Kobus
ccf1d17bfe Silence the warning about missing initializer for member
Silence the following warning:

warning: missing initializer for member
‘clang::tooling::IncludeStyle::IncludeCategory::SortPriority’
[-Wmissing-field-initializers]
  118 |     style.IncludeStyle.IncludeCategories = {{"^<Q.*", 200}};

According to the docs of IncludeCategories, the SortPriority field
is optional, and when not set its value is set to the value of
Priority field. So in order to fix the warning we repeat the same
value for SortPriority field.

In addition we ensure that we require at least clang version 10.0.0.

Change-Id: I8baae7a33ad1a7a7f3afe66779f482b29a7396b4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-11-13 12:11:41 +00:00
Christian Kandeler
eaea03ba42 ClangFormat: Adapt to clang 11 API changes
Change-Id: Id5d977e56017a80138f2c033e145b67446eff3ab
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-04 10:23:19 +00:00
Orgad Shaneh
44023c8f43 Clang: Fix build with Clang/LLVM 10
Change-Id: I740286c9dcfd325b1c31ab863fb5c91bf9c6ec70
Reviewed-by: hjk <hjk@qt.io>
2020-02-20 17:30:27 +00:00
Nikolai Kosjar
6ec8017bc6 Clang: Build against LLVM/Clang 9
Change-Id: I3608bca6541614bb55e67d35c87334957cd02761
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
2019-10-02 13:20:13 +00:00
hjk
c77cef5706 Avoid more deprecation warnings
Change-Id: Icc7bb7a4ccf7fc9f89f6f668c194ccd440e5231c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-05 07:49:48 +00:00
hjk
473a741c9f Utils: Rename FileName to FilePath
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>
2019-05-28 12:23:26 +00:00
hjk
0595e67c82 More FileName::pathAppended()
Change-Id: Ie20ec34ea9712b3ec49e6233b23cef84c2019f03
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-20 14:37:13 +00:00
hjk
1e9636ab8a Some more FileName::appendPath() -> pathAppended() changes
Change-Id: Ie494f7ae8a96d97c9497b3ef38d774d2cf787b7f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-17 07:46:56 +00:00
Ivan Donchevskii
2d8ce380c9 ClangFormat: Fix UI issues
- '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>
2019-04-26 07:55:00 +00:00
Ivan Donchevskii
07557016f8 ClangFormat: Use the global style if no configuration is found
If no .clang-format file can be found and the settings do not
override the configuration neither globally not in the project
then construct the global settings (if required) and use them
instead of constructing the style every time.

Task-number: QTCREATORBUG-22144
Change-Id: Ib59b7f166f030ce3fb085f105f30fbf0eb25b185
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-04-02 11:32:11 +00:00
Orgad Shaneh
d0867955af ClangFormat: Fix GCC8 warnings
* Missing return (false positive. All enum values are covered).
* Unused static function.

Amends commits 7f0589ef59 and
40fcc728b2.

Change-Id: I0e5c4ae09739a7ca9edbbbbe3f081d8a732245e7
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-01 06:56:29 +00:00
Ivan Donchevskii
3017ee23e5 ClangFormat: Fix the filepath to actually pick the selected config
We've searched for the config we want to use but did not change
the path for the source file which is used internally by libformat
to find the configuration.

Fixes: QTCREATORBUG-22048
Change-Id: Ibdcc33ac338f06e966dfc5c06cdb38db3bb768b6
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-03-12 10:10:37 +00:00
Ivan Donchevskii
40fcc728b2 ClangFormat: Use by default the same style as Qt Creator uses
Change-Id: Iae0f774873f66fcd4e297cfc260a8541f4373e36
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-03-07 14:03:45 +00:00
Ivan Donchevskii
243ba8d371 ClangFormat: Add context menu item to open current config file
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>
2019-03-07 10:45:46 +00:00
Ivan Donchevskii
dc9c9249fc ClangFormat: Try to use existing file to override settings
If there is a .clang-format file in the project use it as
a base for the custom file that creator uses to override
the project settings.

Change-Id: I0786dbdd6077b87d4dd428981e24d503668f1031
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-03-06 08:44:05 +00:00
Ivan Donchevskii
bf972bcb01 ClangFormat: Change the logic how configuration is picked
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>
2019-03-05 14:48:59 +00:00