Commit Graph

1581 Commits

Author SHA1 Message Date
Eike Ziller
e7d3842f79 ClangCodeModel: Fix build
At least on Apple Clang there is no default constructor
For Text::Position taking two numbers.

Amends 39a448c62e

Change-Id: Ife3630f53d66be38a52ffeb8693bf7574038d083
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-06-27 09:34:05 +00:00
David Schulz
39a448c62e Editor: Simplify TextDocumentManipulator
The TextDocumentManipulatorInterface was introduced to decouple
modification operations from QTextDocument. But nowadays all tests and
production code usages are backed by a QTextDocument, so we can remove
this abstraction layer again. The first step is to merge the interface
and all manipulator implementations.

Change-Id: Idd1609df549d3b120dd516d5161af9aa8aa571ca
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2024-06-27 04:28:55 +00:00
Christian Kandeler
c0bfd9bbd6 CppEditor: Clean up cpptoolsreuse.{h,cpp}
A lot of code had a more suitable place to live in, some was even
unused.

Change-Id: I36478ef473aa14395a182c9ac5e3738fc93134b6
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-06-24 09:14:47 +00:00
Christian Kandeler
408e986f2b ClangCodeModel: Fix potential crash
... when removing from the list of FollowSymbol operations. The done()
callback of ClangdFollowSymbol messes with the list, so call cancel()
after removing the corresponding iterator.

Change-Id: Ibb72ffa436598692e48119d93d430bb79bcb0f5e
Reviewed-by: hjk <hjk@qt.io>
2024-06-04 09:21:25 +00:00
Christian Kandeler
0e301004b8 ClangCodeModel: Allow more than one in-flight "follow symbol"
The original code was written with only the interactive case in mind, but
nowadays we also start "follow symbol" operations internally as part of
e.g. quickfixes.

Change-Id: I95928297fab16f9b0469bfd66ad687447b902fd9
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-05-31 09:48:41 +00:00
Leena Miettinen
6cd7aed8eb Add long descriptions to some plugins
Edited the short descriptions to answer the question
"What can I do with this extension" to help users decide
whether they need it.

In long descriptions, tell users what else they need to
be able to use the plugin.

Change-Id: Iefce7505b61fc77cf38cc915f1f7dbd25c9cb570
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2024-05-31 06:42:53 +00:00
hjk
efae651924 Utils: Introduce a convenience function creatorColor()
... forwarding to creatorTheme()->color(...)

Change-Id: Iefaa043495127b3e500ed225584481d3ec0f8c1f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2024-05-29 13:49:25 +00:00
Alessandro Portale
7bc65cf9f3 PluginSpecs: Change URLs from http:// to https://
Avoid the redirect that is inevitable nowerdays.

Also, change necessitas.kde.org to www.qt.io, since the orgininal page
is offline.

Change-Id: Ib1823f0df97d2df87822fd2bb7552e2f2c7e971e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2024-05-28 20:13:29 +00:00
hjk
fffa067a00 ClangCodeModel: Fix a qAsConst deprecation warning
Change-Id: I1a4bda015704d6012c8cde14084d51891b0dc0e2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2024-05-28 16:19:38 +00:00
Jarek Kobus
63a93760d9 ClangUtils: Get rid of GenerateCompilationDbResult struct
Replace it with expected_str<FilePath>.
Check periodically for cancel request inside
generateCompilationDB() body.

Cancel the possibly running task on ClangCodeModelPlugin
destruction.

Handle the cancellation.

Change-Id: I8bcb956bc03627b4a17a3510a76810e66c82815d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2024-05-27 09:47:13 +00:00
Christian Kandeler
09f747f7d1 TextEditor: Add a convenience overload for RefactoringFile::apply()
... and make use of it.
In most contexts, apply() immediately follows setChangeSet(), so
combining the two can save a lot of code on the call site.

Change-Id: I421001bd47000cb64678a57b19760becf59a4863
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-05-24 11:36:58 +00:00
Christian Kandeler
8577ab8bcb ClangCodeModel: Bump minimum clangd version
... and throw away old workarounds.
The current clangd version, to be shipped with Qt Creator 14, is 18.1, so
we can safely bump the minimum version to 17.

Change-Id: I74fd5997196d774b6c47dcb522284953ef82ad9c
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-05-24 07:58:22 +00:00
Christian Kandeler
6a8f7ae53b LanguageClient: Let clients opt out of sending the didSave message
... and make use of it in ClangdClient.
When a file gets saved, clangd checks all open documents for whether they
are affected by that. While the answer is usually "no", there is still
one thread per document being started to find that out, which triggers
users who keep a close watch on CPU usage. To alleviate this, we now
send the didSave message only for header files.

Fixes: QTCREATORBUG-28580
Change-Id: Id761cec8b04e95a795c8bd8754466bf03b6f2c28
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-05-21 10:39:39 +00:00
Eike Ziller
c676ec825f AsyncTask: Centralize setting global future synchronizer
Move the global FutureSynchronizer to Utils and use it
by default for AsyncTask (if that is in the main thread).
This way setting a synchronizer is less prone to be forgotten.
Individual uses can still override this.

Change-Id: I1a12bf4d7f4cb5be99668bf0a4797108c2fe6448
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-05-21 09:56:32 +00:00
Christian Kandeler
ce16d58214 CppEditor: Add quickfixes/ subdirectory
We'd like to split up the monster files cppquickfixes.cpp and
cppquickfix_test.cpp by moving non-trivial quickfixes into dedicated files.
Since there will be many of them, we want to have them in a separate
directory. This patch prepares that.

Change-Id: I1e78fab5cce25151662297482582c8043618332e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2024-05-15 10:59:01 +00:00
David Schulz
6e6d25d117 LanguageClient: generate issue pane entries for diagnostics
The clang code model already generated issue pane entries for received
diagnostics. Move the tracking of these issue pane entries to the
generic language client support and also generate entries for other
language servers.

Fixes: QTCREATORBUG-30549
Change-Id: I29f2ffbf199c3fdc5ca59a670f5033c833b96a49
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2024-04-19 10:13:49 +00:00
Eike Ziller
0fe7350368 Merge remote-tracking branch 'origin/13.0'
Change-Id: I0892d8e54930bb5a65dc51117b8ca7d70ce300a3
2024-04-17 13:29:02 +02:00
Christian Kandeler
e52743ae81 ClangCodeModel: Fix context processor
Checking for potential include file completion should only consider
string literals, not number literals.

Fixes: QTCREATORBUG-30607
Change-Id: Ibfb422f1d8be5a5d30489383ecbc359f5ea4a2a9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-04-16 08:30:46 +00:00
Christian Kandeler
3b80da7117 ClangCodeModel: Make "live update" of dependent sources opt-in
Not everyone wants to invest the extra computing resources needed for
this feature.
Amends b33b99e2d9.
See 6d805195f6 for the original
motivation.

Task-number: QTCREATORBUG-29943
Change-Id: I4c8cce5bb58b34d930a409ea3e0995377c90d4ab
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-04-15 08:58:23 +00:00
Christian Kandeler
3ca0deef53 CppEditor: Move ClangdSettings into a dedicated set of files
They were originally put alongside the CppCodeModelSettings for
simplicity, but there is no coupling (anymore?) between these two
classes.

Change-Id: Ic24df109b74a5b5c39de073c938c6de12f4aa319
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-03-28 19:06:08 +00:00
Eike Ziller
8500dd03bf Merge remote-tracking branch 'origin/13.0'
Conflicts:
	doc/qtcreator/src/overview/creator-only/creator-keyboard-shortcuts.qdoc

Change-Id: I2db85da9f4a0593217951313020d71d430986961
2024-03-22 15:13:34 +01:00
Christian Kandeler
5afdc47760 LanguageClient: Prevent duplicate references due to file aliasing
This problem has been observed with clangd, but it's probably a good idea to apply the check generally.
Note that in the case of renaming, omitting the filtering can lead to file corruption.

Task-number: QTCREATORBUG-30546
Change-Id: I007edbae2cba5f59e427ab07e183162df9e99367
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-03-21 08:55:01 +00:00
Christian Kandeler
faa595e38b CppEditor: Introduce per-project code model settings
Change-Id: I325cc39e60d4b1f0fba1651502d772bfb9c6a91c
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-03-15 14:21:21 +00:00
Christian Kandeler
1de045f687 CppEditor: Move some convenience functions to CppCodeModelSettings class
Change-Id: I0af8560c23374ce4f6c46f98d498d44f7cb50db3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-03-12 08:55:11 +00:00
Eike Ziller
1b97fdc100 Merge remote-tracking branch 'origin/13.0'
Conflicts:
	src/plugins/debugger/gdb/gdbsettings.cpp
	src/plugins/perfprofiler/perfprofilerruncontrol.cpp

Change-Id: I0d5b914f9d9b5499920a5db484ef77af6ae748d5
2024-03-12 09:27:39 +01:00
David Schulz
325db93a7b LanguageClient: improve clangd function hint
Add a Clangd specific function hint model that alwys highlights the
current parameter based on the number of commas in front of the cursor
position, like the builtin code model. It also correctly closes the
proposal after typing the closing parenthesis.

Fixes: QTCREATORBUG-26346
Fixes: QTCREATORBUG-30489
Change-Id: I09d3ac6856acfe5e0f206d8c3a96dbb561ea2ce7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2024-03-11 12:39:06 +00:00
Eike Ziller
8abc95331f Merge remote-tracking branch 'origin/13.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	src/plugins/cppeditor/cppcodemodelsettings.cpp
	src/plugins/cppeditor/cppcodemodelsettings.h

Change-Id: I54937c39b06897a72a105e4e0a8b5f8a76c38e26
2024-03-06 15:10:15 +01:00
Christian Kandeler
f56fd04c8d Revert "Clangd: Avoid client restart after modifying open documents"
The whole point of tracking external changes to files is to use the open
files as a sentinel to indicate that non-open files (on which we don't
have a watch) have likely also been changed.
This reverts commit cff26d813a.

Change-Id: I5a8b3e6709eda881b912916cf0838b45d1ff4fa4
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-03-04 10:36:53 +00:00
Christian Kandeler
cc763c80d7 ClangCodeModel: Improve debug output for semantic highlighting
Previously, the final highlighting results we showed were incomplete and
out of order.

Change-Id: If18062cc5a7f3156d6bb0b282aed33906cdef910
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-02-29 13:27:47 +00:00
Eike Ziller
a8414effd8 Merge remote-tracking branch 'origin/13.0'
Change-Id: If752e3383b35873b696e8beca27d8838a4096c8a
2024-02-27 09:04:51 +01:00
Jarek Kobus
97ec97ff27 ClangModelManagerSupport: Skip explicit call to waitForFinished()
This is done by the FutureSynchronizer d'tor, so no need to call
it explicitly. Move the FutureSynchronizer as the last field of
ClangModelManagerSupport so that its d'tor is executed first.

Change-Id: Id38b8ec08579be8e4ade99ecadb511850ff37f8c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2024-02-26 12:30:56 +00:00
Christian Kandeler
5956254e6f CppEditor: Make check for clangd more fine-grained
... in the quickfix factories.
We want to be able to offer or not offer certain quickfixes based on the
current clangd version.

Change-Id: I7dca69ff990ab9f1a691785cd72e633f7882ae3d
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>
2024-02-21 10:02:07 +00:00
Eike Ziller
8826a8b47b Merge remote-tracking branch 'origin/13.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs

Change-Id: I2a3d92a14e4dd16897d19f7d8a8c7b0ec30d14a5
2024-02-19 14:44:54 +01:00
Marcus Tillmanns
4329b67c74 Clangd: Fix version check to use (remote) executable
Fixes: QTCREATORBUG-30374
Change-Id: I4a98a82ea24bb55a2ab3eed72f13d3d6f648df8a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2024-02-15 13:02:23 +00:00
Christian Kandeler
1af555ad09 ClangCodeModel: Let users configure the clangd index location
Fixes: QTCREATORBUG-27346
Change-Id: I9bc59f759682e70b761c0f22a011868008fc0360
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2024-02-12 11:38:57 +00:00
Jarek Kobus
8bcc78a044 Various plugins: Fix some more C++20 warnings about [=] captures
Change-Id: If20aac4320c84096a07d67cc137886638286acf8
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-02-06 08:34:44 +00:00
hjk
ce1e565a10 Utils: Also rename parameteraction.{h,cpp} to action.{h,cpp}
Change-Id: I203909d9b2d460012b9347d507ac7a701700c48a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2024-01-29 14:23:39 +00:00
hjk
66b50438d8 Utils: Rename ParameterAction into Action
It became the defacto-type for action when ActionBuilder started
creating them as default.

Change-Id: I1008d60b78ea83919ce1c80a7ef828527fe9902c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2024-01-29 13:01:29 +00:00
hjk
8b86fe239b ClangcodeModel: Move test creation closer to tested code
Change-Id: Ifb6771673aa8639d2ee23d1f34b1ff821000e348
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-01-24 16:38:09 +00:00
hjk
74cf4efb8a ClangCodeModel: Use ActionBuilder for Generating Compilation DB action
Change-Id: I89d8345351cb6da26b7ae899066a7ddfdb17fe9c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2024-01-22 15:57:35 +00:00
hjk
d234e71643 All: More ToolChain->Toolchain renamings
And removal of one unused function declaration.

Change-Id: I594e23401d8f247d3be081ce850005574951899d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2024-01-19 10:29:33 +00:00
David Schulz
83d2b82eb9 LSP: fix compile with Qt 6.2
Change-Id: Ia0b83166c9b859add450ae36001f3fa30cfb4b55
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Mathias Hasselmann <mathias@taschenorakel.de>
2024-01-12 14:28:16 +00:00
Alessandro Portale
fc3291afed Utils: Proliferate use of <utils/mimeconstants.h>
This deduplicates several mime type strings.

Change-Id: Ib1746387e233ca5b7134e65859b5ec1c7832b8e4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-12-19 09:38:10 +00:00
hjk
570344b066 LSP: Avoid running strlen() on json keys
This feels better when stepping through the code but doesn't
really make a difference in the profile.

Change-Id: I2c30578bf1e990b039caadb8b8ce532f009b775d
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-12-18 10:30:30 +00:00
hjk
c70b051cfe ClangCodeModel: Move plugin class definition to .cpp
Change-Id: I437ca5df1981b11809cbf52efe7aa9aacc1159d7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-12-14 07:37:46 +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
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
016936a450 Clean up some lambdas
Change-Id: Id947c0935b1aa4579e1c64d3e510db41103fbe27
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-12-12 10:55:32 +00:00
Eike Ziller
2e280e1c50 Merge remote-tracking branch 'origin/12.0'
Conflicts:
	src/plugins/clangcodemodel/clangdfollowsymbol.cpp
	src/plugins/debugger/debuggerruncontrol.cpp
	src/plugins/projectexplorer/miniprojecttargetselector.cpp

Change-Id: I45b7fee1a1d784c44f2139fb1ede69190d23d6fd
2023-12-06 16:50:15 +01:00
Christian Kandeler
6d101cd812 ClangCodeModel: Fix following virtual functions
We used to follow a Goto Implementation request with a Goto Definition
request, because the latter gave us the declaration instead of the
definition. This has changed in clangd 17, which means we now called Goto
Definition on a definition, which clangd interprets as switching to the
declaration.
We now do the right thing for all supported clangd versions.

Change-Id: I1c0acd2c8d5c942f7e25dedb1da953bb4f8d8d13
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-12-06 11:48:47 +00:00