Commit Graph

27 Commits

Author SHA1 Message Date
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
Eike Ziller
d42953160b Fix build in clangd tests
Amends 40181057cd

Complained that the Q_DECLARE_METATYPE comes too late.

Change-Id: Id5dd355fadcb4a6790d4c74dd1c637e0b1569aa4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-06-22 07:02:53 +00:00
Christian Kandeler
40181057cd ClangCodeModel: Use clangd for local renaming
Change-Id: I1536265a8d46c9840e722bdfcb8638906d3f45cf
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-21 13:00:40 +00:00
Christian Kandeler
a5ba33cbeb CppEditor: Add second "Find References" Action
This one includes access type categorization, while the "normal" one
does not.
We need this now, because with clangd, the categorization is too slow to
enable it by default.

Change-Id: I2eb4608630d34452ae28f0836befd5d9053f42bf
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-07 08:28:49 +00:00
Christian Kandeler
898558508d ClangCodeModel: Add test for "follow symbol"
These are the tests from clangbackend, so we are now up to par coverage-
wise.

Change-Id: I7b8a63109bff17745782a646f684fd795f732672
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-03 08:15:32 +00:00
Christian Kandeler
ff0301635e CppEditor: Tweak test infrastructure
... so we can re-use the "follow symbol" test cases with clangd.

Call Creator like this (clangd needs to be version 12 or later):
$ QTC_CLANGD=<path to clangd> qtcreator -test
'CppEditor,*Follow*,*Switch*' -test 'ClangCodeModel,*dummy*'

During testing, some invalid code in the test cases was uncovered and
fixed.

Change-Id: I9dc650fdba2a27600e6a550420ee873f6fb31d23
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-02 10:52:50 +00:00
hjk
76db1e3746 Core: Add FilePath based overloads to EditorManager::openEditor{,at}
Part of the overall FilePath migration. Keep the original version for
a while to allow using code to catch up.

Change-Id: Ia7c5ea14416a06e679e8661c0e4045981db87b9b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-25 09:55:50 +00:00
Christian Kandeler
12fd21a880 ClangCodeModel: Implement global renaming via clangd
Note that we do not use the LSP rename functionality. We do "manual"
renaming the same way as in the built-in code model, but based on the
references found by clangd.

Change-Id: Ifa5597efe5c89c8f9204a4f5323bc755544696cf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-05-19 07:58:04 +00:00
Christian Kandeler
6dc3c1f156 ClangCodeModel: Support access type categorization
... with "Find Usages", as we do in the built-in code model.
Note 1: This is very slow, so it's for now only enabled if the
        search results come from a small number of files.
        Possible ways of speeding up the operation
        to be investigated.
Note 2: All test cases from the old code model also pass here,
        but checking with non-trivial real-world projects
        shows a lot of mis-categorizations.
        Well will fix them one by one.
Note 3: This functionality requires clangd >= 13.

Change-Id: Ib3500b52996dbbf9d7d9712d729179bcbd3262fc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-05-18 08:42:04 +00:00