Commit Graph

256 Commits

Author SHA1 Message Date
Christian Kandeler
818dc8b0cc Remove clangsupport dependency from plugins
Change-Id: Ifd4215a590d32cd04fab720d0d8d5e746e81c6e8
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-05-06 08:11:42 +00:00
Christian Kandeler
780f89b377 ClangCodeModel: Bump minimum clangd version
We need clangd >= 14 to get rid of the cumbersome compile_commands.json
creation.

Change-Id: I30c19a385e2d76e478985f3df64968d1cb3efe87
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-05-04 12:55:03 +00:00
Christian Kandeler
969b1f711f CppEditor: Remove RefactoringEngine
Another useless indirection.

Change-Id: Icfcc0704a1056d8002a674edbe74b946cb56ff27
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-04 10:05:31 +00:00
David Schulz
7826012443 clangd: update current document filter after initialize
This makes sure that the lsp filter gets enabled if a document is opened
before the corresponding clangd server was initialized. This happens
when loading a session with an open document.

Change-Id: I7987ea60c6fca8b5c070af3a7bcd5325667ed0c5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-02 12:23:12 +00:00
Christian Kandeler
356b43e9aa ClangCodeModel: Stop communicating with clangbackend
Change-Id: I9a5f4e7f0f94d33de9816cb643e6ec88cbf9ca15
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-05-02 10:36:58 +00:00
Christian Kandeler
6da7babc4a ClangCodeModel: Remove libclang-based completion and function hints
Change-Id: I742fb14b1aba3ba1f35a5c80bf553d2a735cac48
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-05-02 10:31:05 +00:00
Christian Kandeler
b52fac7148 ClangCodeModel: Remove libclang-based diagnostics and highlighting
Change-Id: Ib7c423884b76c27a6350ddea611919d3352fb80e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-05-02 07:51:51 +00:00
The Qt Project
241d8d014b Merge "Merge remote-tracking branch 'origin/7.0'" 2022-04-22 08:30:05 +00:00
Christian Kandeler
7bace9d926 ClangCodeModel: Consolidate clangd highlighting data structures
Put all the highlighting-related data in one place.
No functional changes.

Change-Id: Ic13e755601682895b27a358b5783c52acc11794e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-04-22 08:23:56 +00:00
Eike Ziller
e2d5b6616a Merge remote-tracking branch 'origin/7.0'
Change-Id: I01ce83a2da66bb65af37c0ecc92372789cb85c01
2022-04-22 10:04:39 +02:00
Christian Kandeler
cf96a91b69 ClangCodeModel: Fix mis-detection of class members as operators
The name check was not tight enough.

Change-Id: I5d813a29525bd5b5c23ce04f0bd9e5982a36536e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-04-21 09:17:15 +00:00
Eike Ziller
3b2134711b Merge remote-tracking branch 'origin/7.0'
Conflicts:
	src/plugins/webassembly/webassemblyrunconfiguration.cpp
	src/tools/processlauncher/launchersockethandler.cpp

Change-Id: Iab052af98013aa59282c16f22ae6e9ecb32f50c4
2022-04-20 16:12:41 +02:00
Christian Kandeler
0cb569a39b ClangCodeModel: Fix check for AST nodes from included files
If an AST node contains no file info, then we must use the one of the
parent node, in order not to create highlighting results for tokens from
other files.

Fixes: QTCREATORBUG-27384
Change-Id: I7c6f0c06063df9ce76feef333907d9d4f07a38e5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-04-19 14:04:35 +00:00
Christian Kandeler
b649f288ac ClangCodeModel: Another output argument highlighting fix
Change-Id: I2b784c32706a4eaa837cf999884656d62b253e3d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-04-14 09:57:11 +00:00
Christian Kandeler
9146ce4625 ClangCodeModel: Fix another false positive
... in in output argument highlighting.

Fixes: QTCREATORBUG-27368
Change-Id: I7549fd5c69bfebd0eeda24760d3bf96f2e652c43
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-04-14 09:56:46 +00:00
Christian Kandeler
260095c924 ClangCodeModel: Fix another false positive
... in output argument highlighting.
If there is not enough information for clang to determine the const-ness
of the argument passing (as it can happen in templates), do not report
an output argument.

Change-Id: I8d0143042f02ac44d8d971398014828cff14697f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-04-13 10:25:01 +00:00
Christian Kandeler
53d6aea404 ClangCodeModel: Fix another false positive
... in output argument highlighting.

Fixes: QTCREATORBUG-27367
Change-Id: I80fc7628d62de18f9114290b8104a7a1e9a95c4b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-04-13 08:43:22 +00:00
Christian Kandeler
514ceb25e9 ClangCodeModel: Prevent recursive delete of FollowSymbolData
Fixes: QTCREATORBUG-27323
Change-Id: I3bcff6516e197b62b1a3772e6db598038c5977c9
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-04-11 12:27:51 +00:00
Christian Kandeler
06ce449a01 ClangCodeModel: Fix another output argument mis-detection
We need to relax the range check: In expressions such as x.y->z, the
second argument for the operator->call is x.y, not just y.

Fixes: QTCREATORBUG-27352
Change-Id: Ida542c11c129630f0a1d301508ec5f8076eb9902
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-04-11 07:16:22 +00:00
Christian Kandeler
f27c4214f8 ClangCodeModel: Better icon for static class members
... in completions. Apparently, clangd uses the LSP type "property" for
static members.

Task-number: QTCREATORBUG-27289
Change-Id: Ib296dbade6b2e7c38a761b27b2c024ea98a89523
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-04-07 08:19:05 +00:00
Eike Ziller
ca480ec601 Merge remote-tracking branch 'origin/7.0'
Change-Id: I9a7a9a5579f1f4e277e7927eefb1bab9ca60ad4a
2022-04-07 09:51:40 +02:00
Christian Kandeler
25144c0afe ClangCodeModel: Fix erroneous highlighting as output argument
... for objects with non-const member calls.
Amends 8247f4f3dd.

Fixes: QTCREATORBUG-27306
Change-Id: I13fdf1ff9daf9ac084beda6c1d8ada5801adca4c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-04-04 12:46:28 +00:00
David Schulz
e437cf7a71 LanguageClient: export DiagnosticManager
Change-Id: I60b3e6b14bf364da60fb8b3de6d5d5cc1cd2e634
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-04-01 10:44:39 +00:00
Eike Ziller
c84380cdc8 Merge remote-tracking branch 'origin/7.0'
Change-Id: Ib2267ddbb702564a6e1c8f6b1db802bc9c45759d
2022-03-31 15:32:42 +02:00
Christian Kandeler
a1b910724d ClangCodeModel: Fix local renamings with clangd
This functionality somehow stayed in the proof-of-concept
stage, working only for free functions.

Fixes: QTCREATORBUG-27249
Change-Id: I840beae66314330ce643e159c596e702a0ec3273
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-03-31 07:59:46 +00:00
Eike Ziller
ae6c974fb2 Merge remote-tracking branch 'origin/7.0'
Conflicts:
	src/plugins/android/androiddevice.h
	src/plugins/android/androidplugin.cpp
	src/plugins/android/androidplugin.h

Change-Id: I1a68354415283fe4a7450706520a576d2a1775e0
2022-03-23 14:16:07 +01:00
Cristian Adam
a1929bd9d7 ClangCodeModel: Add some more timing debug information
By setting QT_LOGGING_RULES=qtc.clangcodemodel.clangd.timing=true I can get
values like:

qtc.clangcodemodel.clangd.timing: highlighting: Start to end: 2953 ms
qtc.clangcodemodel.clangd.timing: ClangdCompletionAssistProcessor took: 7343 ms

The first tells you how long Creator took to turn clangd's semantic tokens into
full highlighting info, and the second how long it took for Ctrl+Space.

Change-Id: I99bd04c2889bb7da98c04537eab06d6ed6117167
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-03-21 12:40:33 +00:00
David Schulz
5924268568 LanguageClient: unify client container
Change-Id: I17b5e7ca4999cd5a9ca8e79577f29854082b6c6b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-21 08:48:17 +00:00
Eike Ziller
cd8c4ced81 Merge remote-tracking branch 'origin/7.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: Ic02df53b880d0861d9d9ea0df3e0d381ae99f350
2022-03-11 09:50:48 +01:00
Christian Kandeler
9735049e2c ClangCodeModel: Suppress "Unknown argument" error
Unknown compiler flags are an unsuppressable error in clang.
But we do not want to maintain a blacklist of unsupported GCC and MSVC
options or a whitelist of supported clang options, as both would
constantly go out of date.
As clangd seems to work fine despite the error message, we simply filter
out this type of diagnostic.

Fixes: QTCREATORBUG-27113
Change-Id: Ib32601831eded60daf80eb0ca5cf01bbd71493fa
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-03-02 12:59:54 +00:00
Christian Kandeler
f8cec0a85a ClangCodeModel: Properly highlight static data members
C_STATIC_MEMBER is mutually exclusive with C_FIELD, so it must not be a
mix-in style.

Task-number: QTCREATORBUG-27111
Change-Id: If9e5f44790f1b7d124f4b2e9859f8c2223c0c424
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-03-02 12:59:22 +00:00
Christian Kandeler
8247f4f3dd ClangCodeModel: Do not highlight objects in method calls
... as output arguments with clangd.
We might want to do so in the future, but right now it's not intended.

Task-number: QTCREATORBUG-27111
Change-Id: Ie6941f18943a1d6942901c526c62999cba6c1125
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-03-01 10:14:32 +00:00
Christian Kandeler
41038ba8cf ClangCodeModel: Do not highlight argument of operator*
... as output parameter with clangd.

Task-number: QTCREATORBUG-27111
Change-Id: I5def562dcb9b8b0dac036fd46ed7e996c0297c95
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-03-01 10:04:16 +00:00
Eike Ziller
d295d16ab5 Merge remote-tracking branch 'origin/7.0'
Change-Id: I809383e6c060701a2751197a8bf16add92bfaf0d
2022-02-28 09:21:18 +01:00
David Schulz
f334bd422e ClangCodeModel: prevent text mark annotations in non project files
Since non project files get opened in project specific clients now, the
check whether we should add annotations needs to make sure that the
marks file is part of the client project.

Change-Id: I2790d0f7feb39162686efd06bb3542684d289b95
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-02-25 13:01:40 +00:00
Christian Kandeler
61351da56a ClangCodeModel: Add convenience function
... for creating a highlighting result from a clangd AST node.

Change-Id: Ie1fcfeee5d6b4c562143fce56498ce92a7b4fddb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-25 11:53:59 +00:00
Christian Kandeler
64a1bf6c43 ClangCodeModel: Properly highlight built-in defines
These are not reported as semantic tokens, so consult the AST

Task-number: QTCREATORBUG-27111
Change-Id: I38efcfbdc3197173a50033a74a1bc631eaa8d2c1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-25 11:53:39 +00:00
David Schulz
4452f71201 LanguageClient: avoid optional::value
Potentially throws std::bad_optional_access. Use operator* and
operator-> instead.

Change-Id: Idefa137da53f3663ea88961f1105b93402ec4777
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-24 12:04:38 +00:00
Eike Ziller
41538832c3 Merge remote-tracking branch 'origin/7.0'
Conflicts:
	src/libs/utils/qtcprocess.cpp
	src/plugins/qmldesigner/components/curveeditor/curveeditorview.cpp
	src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp

Change-Id: Id0c31719e46d1c44770ea89663eee321a0517ff4
2022-02-24 11:42:57 +01:00
Eike Ziller
fff5944e65 Fix lupdate issues
When updating translations with
cmake --build . --target ts_de
(or other language ID)

- Qualifying with unknown namespace/class ::PluginSpecPrivate
- <class> lacks Q_OBJECT macro

Change-Id: Ic42d8dffea935e6b10e59223bdedb9a8a4dcf446
Reviewed-by: hjk <hjk@qt.io>
2022-02-23 16:53:00 +00:00
Christian Kandeler
cf90264971 ClangCodeModel: Fix more false output arguments with clangd
For some reason, we never checked the actual matching AST node for
const-ness.

Change-Id: Icb58ba169d82e1ec02c9ff8d17f0170f0a78f99d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-02-23 10:54:32 +00:00
Christian Kandeler
7b82b55b73 ClangCodeModel: Don't highlight streaming operator args as outputs
... with clangd.
As with operator++ etc, it's immediately obvious to a developer which
arguments are modified.

Change-Id: Ia2b15d5eef7848b7ed284f8d544f039fe2927292
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-02-23 10:53:52 +00:00
Eike Ziller
8259df00d0 Merge remote-tracking branch 'origin/7.0'
Conflicts:
	src/plugins/mcusupport/mcupackage.cpp
	src/plugins/mcusupport/mcusupportoptions.cpp
	src/plugins/mcusupport/mcusupportoptions.h
	src/plugins/mcusupport/mcusupportoptionspage.cpp
	src/plugins/mcusupport/mcusupportplugin.cpp
	src/plugins/mcusupport/mcusupportsdk.cpp

Change-Id: Ib423e9f23877176f01b188104b0a179ed32c4770
2022-02-22 14:06:41 +01:00
Christian Kandeler
022510f1e6 ClangCodeModel: Mention project name in clangd indexing message
This will help avoid confusion in case of multi-project sessions.
We also shorten the message a bit so it won't be cut off in the progress
bar before the project name.

Change-Id: I0e5885f89a976b14f758f9be77e7669f199cd887
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-02-18 13:39:31 +00:00
Christian Kandeler
a08e0f7a9d ClangCodeModel: Differentiate between clangd debug output log levels
Depending on the kind of highlighting issue we want to debug, we may or
may not be interested in the actual tokens.

Change-Id: I412126d3e97949a31f1dd5f339dc09072f28be64
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-02-18 08:55:54 +00:00
Christian Kandeler
15280d7127 ClangCodeModel: Request clangd quickfix for -Wswitch warning
This way, a warning about missing switch cases will be accompanied by a
matching code action, which allows the user to fix it right away by
clicking on the lightbulb.
Requires clangd >= 15; see https://reviews.llvm.org/D118976.

Change-Id: I11e82264c41e4154f979d28a5e44e72c8158595b
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-02-17 12:38:49 +00:00
Christian Kandeler
4cd18fb3a4 ClangCodeModel: Factor out clangd compilation db update
We want to re-use that code.

Change-Id: I9b9201b63ef4c375c24efa402c80769634287714
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-02-17 08:10:31 +00:00
Eike Ziller
49ecd64b9c Merge remote-tracking branch 'origin/7.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/docker/dockerdevice.cpp
	src/plugins/mcusupport/mcupackage.cpp
	src/plugins/mcusupport/mcupackage.h
	src/plugins/mcusupport/mcusupportoptions.cpp
	src/plugins/mcusupport/mcusupportoptions.h
	src/plugins/mcusupport/mcusupportoptionspage.cpp
	src/plugins/mcusupport/mcusupportsdk.cpp
	src/plugins/mcusupport/mcusupportsdk.h

Change-Id: I8c8f5953a21729ba9178dbc44ed613eed131a0c8
2022-02-16 10:59:04 +01:00
Christian Kandeler
dad534005e ClangCodeModel: Do not set C_ENUMERATION for enum declarations
... when highlighting with clangd.
This value is only meant for enum values, not types.

Task-number: QTCREATORBUG-27059
Change-Id: I7bb68f5deb6bb215ee3c23d995207019850a7bfc
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-02-15 13:58:51 +00:00
Christian Kandeler
6414f22be7 ClangCodeModel: Fix highlighting of literals with clangd
Some literals are keywords.

Task-number: QTCREATORBUG-27059
Change-Id: I6315bfd4e4179990e55bc046084fdf0a4e3f9e8e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-02-15 13:58:36 +00:00