Commit Graph

342 Commits

Author SHA1 Message Date
hjk
f2fb88df2e ClangFormat: Move test creation out-of-sight
Change-Id: I6403f5e0ab4783075ff6e87299317dc1988140db
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-01-19 13:38:30 +00:00
hjk
5f9b36b45a ClangFormat: Pimpl ClangFormatBaseIndenter
This avoids the large-scale exposure of #include <clang/Format/Format.h>
which otherwise confuses moc.

Change-Id: I1d48174bd5f940e03986b58a7efa5e537cc99781
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-01-19 13:38:26 +00:00
Artem Sokolovskii
bb88c8c9be ClangFormat: Separate ClangFormat and Standard Indenter UI
The combined UI was a bit misleading for the user and cause
bunch of synchronization problems.

The synchronization between old CodeStyle settings and ClangFormat
settings was removed. Corresponding classes and functions
were also cleared.

The behavior now:
When "Indenting only" or "Full Formatting" modes are chosen then
The ClangFormat settings page is visible and the ClangFormat indenter
is used.
For "Disable" mode standard CodeStyle pages are shown and standard
indenter respectively.

Change-Id: Idb4974c68ceb16ef2e55b108043cc6f56f859840
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2024-01-19 10:26:09 +00:00
Tim Jenssen
399f7a1968 Merge remote-tracking branch 'origin/qds/dev'
Change-Id: I5d593fc74785958886453dc0b452c25356a8c65f
2024-01-18 11:15:29 +00:00
Artem Sokolovskii
34e537a063 ClangFormat: Fix formatting for LineEnding CRLF
Change-Id: I10abc07f5d178a7114faba7174ea1bfc80965174
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-01-17 13:13:35 +00:00
Artem Sokolovskii
2d96d1a39f ClangFormat: Add parseConfigurationFile utility function
Change-Id: I7824e6bb77e9976aa212cdef478c4d40c4d8c56c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2024-01-10 10:26:51 +00:00
Artem Sokolovskii
f2cb979aa3 ClangFormat: Rename override checkbox
It improves the UX design of CodeStyle page.

Change-Id: I4458896d6787df462de18025d292bdb481d03c89
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-01-08 13:50:38 +00:00
Jarek Kobus
e928c19d27 ClangFormat: Get rid of EXPLICIT_MOC
Otherwise it generates the following:
"No relevant classes found. No output generated."
during compilation.

Change-Id: Ia0299db40412a8ba1543f6990a728b2ac3af07ac
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2024-01-03 21:22:50 +00:00
Eike Ziller
10d389f59f Merge remote-tracking branch 'origin/12.0'
Conflicts:
	src/plugins/clangformat/clangformatconfigwidget.cpp

Change-Id: I84fba4e6f952e9aca606951e7fb7763b451e35d9
2024-01-03 13:05:56 +01:00
hjk
2945dc379f ClangFormat: Dont create a style factory to only use the indenter
Change-Id: I2bfe7c7a68341a4a11439067581f5704b1388164
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
2023-12-21 14:33:33 +00:00
hjk
37c9b41273 ClangFormat: Remove some unused includes
Change-Id: I8d382b91acc60f62be2055c0124704d38b3c7f46
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
2023-12-21 14:33:26 +00:00
Artem Sokolovskii
a0cc2e3c3e ClangFormat: Fix preview update
Fixes: QTCREATORBUG-30089
Change-Id: Id89e8b2ee0439c5235755256e8410f42ad94b432
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-12-21 12:02:50 +00:00
hjk
aff66f9060 ClangFormat: Simplify menu action handling
Change-Id: Ic4a5a6023c2f8f43b30010c14e245d0879da9ab1
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-12-15 09:58:58 +00:00
Jarek Kobus
86d0ff1b61 CppEditor: Fix a warning about unused arg
Amends 0e04f40fa7

Change-Id: I5acd596670bb3332f6e6d1984ec5ccb75c3e161a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-12-13 18:45:49 +00:00
hjk
81098efbe6 ClangFormat: Declare QWidget when needed
Amends 120041905.

Change-Id: I88ecd1507cb1817ea315481b9aed430889995c16
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
2023-12-13 15:45:15 +00:00
hjk
b442ca3873 Core: Rename ActionBuilder::setOn* to addOn*
There could be multiple connections.

Change-Id: I7dbca9d24599f776b7d1f1bfa11826e3eeb5640a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-12-13 13:00:00 +00:00
Christian Kandeler
3b7d29d2a1 Utils: Add formatting information to ChangeSet::EditOp
... and make use of that in TextEditor::RefactoringFile.
This allows calling code to have fine-grained control over which parts of
a refactoring should get re-formatted, while also providing sensible
default values that are "almost always" right, so things typically work
as expected out of the box.

Change-Id: I9200c2135b7477c33bc5a61c5d410b34853e4b61
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-12-13 12:29:08 +00:00
Christian Kandeler
0e04f40fa7 CppEditor: Fix "testInsertAndFormatDefsFromDecls" test
Amends 240748c106.

Change-Id: I13a4eb28737636dbb5f5f5c1c7ab771a4518a701
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-12-13 12:27:54 +00:00
hjk
1200419059 ClangFormat: De-Q_OBJECT and de-pimpl ClangFormatConfigWidget
Somewhat tighter code.

Change-Id: I8fde17ac66d0b1e49eb6554800f0f40d8f214ee3
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
2023-12-13 11:09:41 +00:00
hjk
e17f0b6164 Core: Rename ActionBuilder::setContainer to addToContainer
An action/command can be used in several places.

Change-Id: Ifa26f64f7d200d93ada13f272de0fa833f886997
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-12-13 08:37:10 +00:00
hjk
72d5cc7d01 ClangFormat: Use ActionBuilder
Change-Id: Ia276db9928193781ab90d34db01447498f40f4d1
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-12-13 07:58:13 +00:00
Artem Sokolovskii
62ea85ee6a SyntaxHighlighter: Move SyntaxHighlighter to separate thread
This change involves the relocation of SyntaxHighlighter processing
to another thread. The core idea is to create a duplicate of the
original TextDocument using SyntaxHighlighterRunnerPrivate::cloneDocument.
A new SyntaxHighlighter is then instantiated by SyntaxHighLighterCreator
for the cloned document. The entire SyntaxHighLighterCreator class is
moved to a new thread, where it performs highlighting on the cloned
document. Upon completion of the highlighting process, the resultsReady
signal is emitted, and the updated highlighting data is applied to the
original document.

This shift of SyntaxHighlighter to another thread enhances the user
experience by preventing UI slowdowns during the highlighting process.

- Introduction of BaseSyntaxHighlighterRunner as an interface class for
future *SyntaxHighlighterRunner.
- Inclusion of DirectSyntaxHighlighterRunner class for performing
highlighting in the main thread, suitable for syntax highlighters
that cannot be moved to another thread.
- Introduction of ThreadedSyntaxHighlighterRunner class for highlighting
in a separate thread, preventing UI blocking during the process.
- Addition of Result data to the SyntaxHighlighter class to facilitate
data exchange between threads.

Task-number: QTCREATORBUG-28727
Change-Id: I4b6a38d15f5ec9b8828055d38d2a0c6f21a657b4
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-12-11 09:55:02 +00:00
Eike Ziller
57d4ea4dcc Merge remote-tracking branch 'origin/12.0'
Conflicts:
	src/plugins/designer/formeditor.cpp
	src/plugins/git/gitplugin.cpp

Change-Id: I554a844fab4c55249a00f394f9ba174c7548dbbe
2023-12-11 09:28:21 +01:00
Artem Sokolovskii
ee75c7276b ClangFormat: Fix utf8 symbol indentation
Fixes: QTCREATORBUG-29927
Change-Id: I5a5a326e13cbe3a874a66e275ded0c6dea9964d7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-12-08 17:48:39 +00:00
Artem Sokolovskii
4bfc3476f4 SyntaxHighlighter: Move highlighter creating to TextDocument
Added setSyntaxHighlighterCreator function to TextDocument
which allows the creation of highlighters inside TextDocument.

Change-Id: I454f800c878c48a154dad5abd68b7a4f9ceb378a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-11-20 14:52:20 +00:00
Artem Sokolovskii
25fa42c3a2 ClangFormat: Remove set standard to cpp11
Standard sets to Auto a few lines further.

Change-Id: Id0bb61cb38fbabd682123baa3860ebdaf5b10846
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-10-26 14:09:35 +00:00
Eike Ziller
ad7d559028 Tr: More small fixes
Change-Id: I5d9324d3f64eaa522fa1d435efa39fa43d84798a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-10-18 12:10:45 +00:00
Christian Kandeler
70f4d9bda0 ClangFormat: Lower the file size threshold
E.g. cppquickfix_test.cpp in Qt Creator is ~260KB, and editing it is
quite sluggish with ClangFormat enabled.

Change-Id: Ifa0db8198b8c15fd03571176b9e94f046da3e44d
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
2023-10-04 12:37:32 +00:00
Artem Sokolovskii
759535be1a ClangFormat: Regenerate clangformatchecks for clangformat 17
Fixes: QTCREATORBUG-29690
Change-Id: I9bbe0c531087824fc160bae210c8444b3ac67ba5
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-10-04 11:32:18 +00:00
hjk
342e066886 Utils, all: Standardize on QtcSettings
Change-Id: Id222016f15b1c3bfe6710fe5d0297666d4565ef1
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-09-27 13:25:31 +00:00
hjk
d6fe357d81 Utils: Use a proper class as Key
The Key encapsulates now a QByteArray.

Plan is to use QByteArray::fromRawData on literals, but that's not
active yet due to an unclear ASAN report, see the gerrit discussion.

For now we also paddle back when interfacing QSettings, instead of mimicing
writing a QVariantMap (and fail in some corners), always convert
the Store. This is meant to go away in the future when code paths
are better controled.

Change-Id: Id1206a434d511f8003903d5322c7c9bd5f5fb859
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-09-27 09:41:44 +00:00
Marcus Tillmanns
0c7e7c545a ClangFormat: Fix compilation with Qt 6.2.4
Change-Id: I71f28a258ad9f3b2e745c409edb6d2fe1a5bfea3
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2023-09-05 08:25:05 +00:00
hjk
c7710acadd Utils: Use Key more widely in QtcSettings
And adapt user code.

Change-Id: I6efe4ebe6823de4cc862f304a57e041b02c40eac
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-30 07:38:02 +00:00
Artem Sokolovskii
a7fcb71b90 ClangFormat: Add warning for clangformat version
Added warning when current clangformat major version does not
match with version what checks was generated for.

Change-Id: I818c9a4f79385cba4e492ea5428bb051f329a9d4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-08-11 08:40:01 +00:00
Artem Sokolovskii
0d3e66a5b8 ClangFormat: Regenerate clangformatchecks
- Regenerated clangformatchecks for clang-format-16
- Updated clangformatconfigwidget for using new clangformatchecks

Fixes: QTCREATORBUG-29434
Change-Id: If308942b6fbe4cc2568acda6d421139175ac081a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-08-03 13:14:22 +00:00
Eike Ziller
960ebb3a85 Merge remote-tracking branch 'origin/11.0'
Change-Id: Ic24d9800eceafa17c51f2ac9c989f55a9b6e920a
2023-08-03 13:18:37 +02:00
Björn Schäpers
9ad9e49ccf clang-format: Fix build with LLVM 17
Change-Id: Ie6377be3be4a8c785d53f1eceabcc4811db4229d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-08-03 09:55:35 +00:00
Jarek Kobus
8dd46d0399 Various Plugins: Simplify return FilePath statements
Change-Id: Ia9efb86f722caca1492b577d51442f1f23b804b4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-08-02 08:19:23 +00:00
hjk
75d9dc2d31 CppEditor: Apply 'static pattern' to CppToolsSettings
Change-Id: I1632787e1a1ebf60427c92b302b25a1a2550853f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-07-26 13:35:28 +00:00
Eike Ziller
a419670ff5 Build: Change plugin json.in files to CMake style
They were still using variables in qmake style.
Directly use CMake variables in the json.in files and remove the no
longer needed escaping of quotes.

Adds a fatal message if it detects the old style in a .json.in file for
easier porting.

Change-Id: I8de88d8db2da55781f0e9d72eda03f943723188e
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-07-25 13:21:16 +00:00
David Schulz
4743724d4c Editor: replace Utils::Text::Replacement with Utils::ChangeSet::EditOp for formatting
Removes the last usage of Utils::Text::Replacement with a more commonly used pattern.

Change-Id: I0912bf61388a58ddaba424380ec139f9aa15fc4c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-07-04 11:39:30 +00:00
David Schulz
61fc1fd452 ClangFormat: remove identical prefix and suffix from replacement text
To reduce the changes done to the document iterate from the start and
back of the replacement text and check whether the document already contains
the proposed changes.

This also fixes the misplaced snippet part in the if else snippet.

Change-Id: I4519ed101cc03e7c49b3a9b775087361c3fd158d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-07-03 09:24:00 +00:00
Christian Kandeler
a39119669c CppEditor: Format quickfix code only if formatting is enabled
... in the ClangFormat settings (rather than the default of just
indenting).
As opposed to files generated by the wizard, quickfixes are often touching
existing code, and since ClangFormat works on line granularity, users
will experience unexpected re-formattings when ClangFormat is in indent-
only mode.
Therefore, do the formatting only if the user has enabled it in the
ClangFormat settings.

Change-Id: Icb30f166f2b6fb94113a8f25c4a5f92ff8bca9b0
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-03 08:47:42 +00:00
Eike Ziller
3e65778d66 Merge remote-tracking branch 'origin/11.0'
Change-Id: I8be5a00000a6699346ed1c44c0711d1f017462a7
2023-06-27 15:20:18 +02:00
Artem Sokolovskii
646eb5118b ClangFormat: Fix missing label in project settings
Fixes: QTCREATORBUG-29323
Change-Id: Ia8c89ec6b8c745cac2bcb13a149667d9c3e08496
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-06-27 10:51:02 +00:00
Artem Sokolovskii
0720042e1c ClangFormat: Make the behavior of the braces tab clearer
Fixes: QTCREATORBUG-29069
Change-Id: I078b7fbb6f98088f615d74a189cce00f8e5fa5fe
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-06-27 10:50:50 +00:00
Eike Ziller
6c601b8cd4 Merge remote-tracking branch 'origin/11.0'
Change-Id: I8d1c9720a868da02b3157a48954eb4e262539c84
2023-06-15 09:48:58 +02:00
Eike Ziller
68915713bf Merge remote-tracking branch 'origin/10.0' into tr
Conflicts:
	src/shared/qbs
	tests/system/suite_general/tst_opencreator_qbs/test.py

Change-Id: I683ebb489e7c2112b343bb3631f6343fdc84cc4a
2023-06-15 09:43:24 +02:00
Eike Ziller
e7870f736d Merge remote-tracking branch 'origin/11.0'
Conflicts:
	src/plugins/clangformat/clangformatutils.cpp

Change-Id: Ide285cc25fca9101843ab9dca01c5a33644aca7f
2023-06-14 08:43:08 +02:00
Eike Ziller
c35dca17b8 Some more tr fixes
- avoid manual line breaks
- fix plural
- add some translator comments
- explicitly name an output pane
- use imperative for placeholder text
- it is a Markdown editor nowadays, not a viewer

Change-Id: I8418cfe0294c028b7d873305db0af4c25bc1097f
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-06-14 06:10:53 +00:00