Commit Graph

58 Commits

Author SHA1 Message Date
Christian Kandeler
5f15e1f066 ClangCodeModel: Relax check for const-ness
... when detecting output arguments with clangd.
This should lead to fewer false positives. We plan to handle false
negatives on a case-by-case basis (rather than the other way around).

Change-Id: I541b418927dc410c2ea4ea9f6c1b5a7bd291a1a8
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-12-10 08:40:34 +00:00
Christian Kandeler
fc3b7f7ac5 ClangCodeModel: Fix access type categorization for functions
... with clangd.
The code is starting to look rather hacky and might need to be rewritten
completely at some point. Let's see how far we get with it.

Change-Id: I506dd410831970b9f9291b005129b4d70f397de0
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-12-10 08:39:57 +00:00
Christian Kandeler
0f9aa307a3 ClangCodeModel: Highlight Q_PROPERTY declarations with clangd
We re-use the moc parser for this purpose.

Change-Id: Ib0ef4f727d1f0b862a202a95a3ae9c551cb502a5
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>
2021-12-03 10:10:10 +00:00
hjk
56009b8b15 Merge remote-tracking branch 'origin/6.0'
Change-Id: I0eae76ecff1a315877e4fdd471f0de3a3a55f180
2021-11-24 11:37:12 +01:00
Christian Kandeler
7498b5523a ClangCodeModel: Fix another mis-highlighting with clangd
Output parameter marking strikes again.

Change-Id: Id98e07e87824a9db435d09482235d56c6808d42e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-23 16:43:37 +00:00
hjk
4de74a67ee Merge remote-tracking branch 'origin/6.0'
Change-Id: I773141d47e3f2b773da51f2e26ef53b93bb28f90
2021-11-22 13:18:08 +01:00
Christian Kandeler
799ffe7e0e ClangCodeModel: Fix possible crash in clangd test
Change-Id: Ifb68b62f1076fa6b086717d7a5db939e52e5e9f2
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-22 09:50:56 +00:00
Eike Ziller
eba4115b82 Merge remote-tracking branch 'origin/6.0'
Change-Id: I3bab4e31bc5993c59c7025ebde0846bf6c75810e
2021-11-19 10:44:15 +01:00
Christian Kandeler
037d2b3889 ClangCodeModel: Fix clangd highlighting of string literals
... passed to macros defined in a different file.
This amends e77e57420a. Contrary to our expectation, it is possible that
AST nodes that are marked as belonging (only) to a header file can
contain child nodes that belong to the main file.

Fixes: QTCREATORBUG-26553
Change-Id: I4d1d877d8e1e2dcf7d81b63aa98e1149b5514e3f
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-17 14:46:37 +00:00
Eike Ziller
ff5bfe6f0f Merge remote-tracking branch 'origin/6.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: I366a1a0e378811dfc9b4e6f42ec96426dbb15356
2021-11-15 13:14:24 +01:00
Christian Kandeler
0c60370f3e ClangCodeModel: Fix Qt header completion with clangd < 14
The problem is fixed upstream, but this must work now.

Fixes: QTCREATORBUG-26482
Change-Id: I3b2e863efec0edf7eaa74d73eb94705aa28723cf
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-11-11 13:15:11 +00:00
Eike Ziller
164aae53d2 Merge remote-tracking branch 'origin/6.0'
Conflicts:
	src/libs/utils/theme/theme_mac.mm
	src/plugins/android/androiddeployqtstep.cpp
	src/plugins/debugger/lldb/lldbengine.cpp

Change-Id: I5f2c62e0bce6c91a53a554b3278dbe23ff7dde36
2021-11-11 13:04:42 +01:00
Christian Kandeler
af647841cf ClangCodeModel: Fix erroneous marking of lambda parameter
... as output argument when using clangd.

Change-Id: I35ef2da235cb317bb7eb1f08b865ea62c27d3b76
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-11 09:27:08 +00:00
Christian Kandeler
397cbd77ab ClangCodeModel: Fix highlighting problem with template types
With clangd, we mis-detected variables of template types as output
parameters in certain contexts.

Change-Id: I906abd489f987351793f4ef676e4af59cdfdbf97
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-10 09:04:52 +00:00
Eike Ziller
e6d31c2b37 Merge remote-tracking branch 'origin/6.0'
Change-Id: I560583b200db8f180574256d6d851a867be11c37
2021-11-04 13:52:30 +01:00
Christian Kandeler
33b5fa25a8 ClangCodeModel: Do not mark the LHS of assignments as output parameters
... when using clangd. Amends a1f088376a.

Change-Id: Ief442d978e1cf3027dcba5a3c75b66c0f4ae8809
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-04 09:20:30 +00:00
David Schulz
426fde79d6 LanguageClient: support semanticTokens/refresh
Fixes: QTCREATORBUG-26499
Change-Id: Icd5879609bb856797fa223394357a1f15554d2cf
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-11-03 07:46:50 +00:00
Eike Ziller
195abefe7d EditorManager: Remove QString openEditor(At) overloads
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>
2021-11-02 08:11:14 +00:00
Christian Kandeler
c3a1193969 TextEditor: Add highlighting category for namespaces
... and make use of it in the built-in code model and with clangd.

Task-number: QTCREATORBUG-16580
Change-Id: I8c331f56aa1bbf91c9f768be82a779a72f40c4c7
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-29 08:36:20 +00:00
Christian Kandeler
d8d4739bc4 TextEditor: Allow special highlighting for static members
Task-number: QTCREATORBUG-9659
Change-Id: Idae529fd876ba5f555c76e4d282efc9263263d6c
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-28 10:04:57 +00:00
Christian Kandeler
a1f088376a ClangCodeModel: Mark output arguments also for lambdas
... with clangd.
This required rewriting getAstPath(), because the previous
implementation did not do the necessary backtracking and could therefore
miss the AST branch containing the node fully matching the input range.

Task-number: QTCREATORBUG-22381
Change-Id: Id5caf2a401b920c0e76f742bec97b5ca6977b4df
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-27 11:22:52 +00:00
Christian Kandeler
78d6c0a15e ClangCodeModel: Adapt test to upstream fix in clangd
See https://reviews.llvm.org/D111224.

Change-Id: Id880468976e9036aa0c6212905101050ff43e34b
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-27 09:18:58 +00:00
Christian Kandeler
111ca0964e ClangCodeModel: Adapt test to upstream bugfix
See https://reviews.llvm.org/D110825.

Change-Id: I829a20a08cd0afd8d225e5c5e6d0aa2cf3b365d6
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-05 07:26:09 +00:00
Christian Kandeler
d52e7b9398 LanguageClient: Make sure to run callback in all code paths
... when receiving a reply for textDocument/definition.

Change-Id: I08f3a22f7c39a33b7b84539125a76d0c0d625692
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-01 11:40:38 +00:00
Christian Kandeler
ec7c60cd67 ClangCodeModel: Do not report non-type template parameters as types
... with clangd.

Change-Id: I9edad375eacc6c33a833c88da64dc29f79334157
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-01 11:40:08 +00:00
Christian Kandeler
be3dd751cb ClangCodeModel: Replace FIXME comments with links to bug reports
Change-Id: Ib6520781e88b8dcf63dd553e199939ff65ae1f05
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-30 08:19:07 +00:00
Christian Kandeler
324105febe ClangCodeModel: Fix a test
The missing header file threw off parsing for some of the code below.

Change-Id: I29f7895b4d88856cc39fd8e33742a37734953b9e
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-29 13:05:04 +00:00
Christian Kandeler
5e9ac00f19 ClangCodeModel: Replace FIXME comment with link to upstream bug report
Change-Id: I90524adbbc4481cb3e1a3c1bf40ae543cdaf6cd0
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-29 09:59:59 +00:00
Christian Kandeler
29c0512416 ClangCodeModel: Do not use clangd for completing #ifdef & friends
Annoyingly, LLVM does not complete preprocessor directives in disabled
code, so that we would not offer e.g. "#endif" after "#if 0" (but we
would offer it after "#if 1").
Fixing it would require messing with the clang libs (rather than just
clangd), so let's just keep using our existing code, which seems to work
fine.

Change-Id: I9dabf9a2a8f3a2f68e88a11b62c3df3b5e64a55c
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-29 09:31:33 +00:00
Christian Kandeler
7b53ce3439 ClangCodeModel: Replace FIXME comment with link to upstream bug report
Change-Id: I0ad5c67a481b72d637a4ea8793a7c6cb7b263a30
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-29 09:30:00 +00:00
David Schulz
e7f6abc084 LanguageClient: remove codeassist proposal handler
Removes noise from the interface. Using specialized clangd processors
that redirect the proposals for testing purposes is an overall cleaner
solution.

Change-Id: Ia4f3d4720765f0533c5530a2a5c7db3cc971e0be
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-09-28 09:50:46 +00:00
Christian Kandeler
b35630c03d ClangCodeModel: Highlight "override" and "final" with clangd
Change-Id: If30de546ce360ab9bc3cfa2780f61d6a78e4191d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-09-27 15:03:50 +00:00
Christian Kandeler
b10641caa2 ClangCodeModel: Adapt clangd test to upstream change
See https://reviews.llvm.org/D110324.

Change-Id: I9dbc03dd814392939be28d1943515d581f9f5b58
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-24 08:42:21 +00:00
Christian Kandeler
f8c2ab9f7a ClangCodeModel: Remove outdated FIXME
Change-Id: I0f69ab0848c5196bf6cedd467bdff74d0d74dfda
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-24 08:41:46 +00:00
Christian Kandeler
002d0a97aa ClangCodeModel: Add XFAIL-ing test for clangd completion
Change-Id: Ic8672d5ce14b9a8d86dc511c5aa3289037258d64
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-20 08:26:57 +00:00
Christian Kandeler
56f9d17d35 ClangCodeModel: Fix an instance of mis-highlighting with clangd
In the expression x.f(), x was wrongly categorized as an output
parameter if f was a static function.

Change-Id: I9167f98916963cdaa4b5ac6ead2c86fab43ad02e
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-17 08:48:52 +00:00
Christian Kandeler
d583dde17b ClangCodeModel: Force clangd restart on external changes
Neither we nor clangd can afford to watch all source files, which means
that after e.g. a branch switch we can easily end up in an inconsistent
state.
We alleviate this problem by restarting clangd if at least one open file
was changed externally.

Change-Id: I7e0d14835e3afbd7a64c3233614f2161282dddc0
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-07 10:05:28 +00:00
Christian Kandeler
847a03786c LanguageClient: Re-highlight also on empty deltas
This is needed for e.g. ClangdClient, which may need to update even if
the highlighting delta from the server is empty.

Task-number: QTCREATORBUG-26183
Change-Id: I38398c9563fa7a6a1906c5cb57fd1cbcd444cbd9
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-07 09:12:13 +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
Christian Kandeler
e0e8fda580 ClangCodeModel: Use clangd for completion and function hint
Change-Id: I80160f3a40da18ac178682afe6caba5e5af6e3eb
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-23 09:06:31 +00:00
Eike Ziller
94d352ab28 Merge remote-tracking branch 'origin/5.0'
Conflicts:
	src/plugins/autotest/testresultdelegate.cpp

Change-Id: If172206f231fc2a9f4a672cd2e6eaeaea4988c96
2021-08-18 16:14:24 +02:00
Christian Kandeler
49b0026826 ClangCodeModel: Adapt clangd tooltip test for include directives
This feature was recently added upstream
(https://reviews.llvm.org/D107137).

Change-Id: I022855cd5d69230b755cdd657c5a7df2db5508ce
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-18 12:10:34 +00:00
Eike Ziller
c7168d1063 Merge remote-tracking branch 'origin/5.0'
Conflicts:
	src/plugins/coreplugin/locator/executefilter.cpp

Change-Id: Iff5b82a9e491b782e4720138904f389d318b005c
2021-08-11 10:10:51 +02:00
Christian Kandeler
11da66f768 ClangCodeModel: Adapt to new "virtual" modifier
... in clangd's semantic tokens.
See https://reviews.llvm.org/D107145.

Change-Id: Idf9fe327df3fb806697ab5b806e89bb62d43e706
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-05 15:00:42 +00:00
hjk
9b250ea2c0 ProjectExplorer: Use FilePath in ProjectExplorer::openProject{,s}()
Change-Id: Ibfb7ab5ef7226b85452bd37b840408708935453b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-07-27 11:35:47 +00:00
Christian Kandeler
68846a7729 ClangCodeModel: Provide highlighting via clangd
Note that we lose the highlighting for virtual function calls. We need
to amend clangd to add the respective information to its semantic tokens
message.
Also, Qt properties are no longer highlighted as class members. We'll
investigate how to best restore this feature.

Change-Id: I403712aada3d7a8e1c7b7c1277f43f7f64f8450b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-07-05 07:39:06 +00:00
Christian Kandeler
58f0f3928c Clangd: Fix tooltip test
- We require the "full AST" feature from clangd 13.
- QSKIP does not work like QEXPECT_FAIL.

Change-Id: Ie1c417013d668ace600fad76e83276ca961b8327
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-07-02 07:08:57 +00:00
Christian Kandeler
fbb804c442 Clangd: Add per-project settings
Users might want to use clangd for certain project, but not for others.

Change-Id: Id29ce3349f0acd359cf7c824ece073b147ed2280
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-30 15:09:56 +00:00
Christian Kandeler
673d596c84 ClangCodeModel: Provide tooltips via clangd
Note that we temporarily lose the ability to hover over an include and
get the full path of the header file. This is a valuable feature that we
need to restore, preferably by fixing clangd itself.
Fixing the remaining few test failures would likely require more
complicated code as well as additional LSP round-trips, and as of now
I'm not convinced it is worth the effort.

Change-Id: I08c72c4bd1268bbd67baeb57bbfd29d9b11303a5
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-30 08:49:24 +00:00
Christian Kandeler
ba138a1855 CppTools: Add dedicated settings and settings page for clangd
We plan to add more clangd settings, and it makes sense to have a
dedicated place for them both in the code and the UI.

Change-Id: Ideb92935b7a5a6a98e07980f4011736fb82042d1
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-28 10:34:24 +00:00