Commit Graph

23 Commits

Author SHA1 Message Date
Christian Kandeler
dc4a8b3866 TextEditor: Allow incremental proposals
... and make use of them with clangd.
This way, users can get immediate feedback when a new proposal entry
has been found, rather than having to wait until all of them have been
collected.

Change-Id: I2adfe0153aa7a058f28eb3bd65c71dd30ea018e0
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-18 11:43:08 +00:00
Christian Kandeler
41dafc8132 ClangCodeModel: Implement declaration/definition switch via clangd
Change-Id: I522a415d76fbc5332e5cc1fdfd2d7ab19cb9ed64
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-18 11:11:17 +00:00
Christian Kandeler
072958c3b0 ClangCodeModel: Do not include base declaration in virtual overrides
... if the cursor was on it.

Change-Id: Ie0d6981e9f0d23a57c430f3aa33448e8f9002ee9
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-17 06:13:37 +00:00
Christian Kandeler
3e5621428b ClangdClient: Handle C files
We somehow forgot to add the corresponding mime type to the language
filter.

Change-Id: Idefe2ed1dfe689340dabcf98363b3d160168000b
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-17 06:13:15 +00:00
Christian Kandeler
692995ec88 ClangCodeModel: Tighten the check for qualified member function call
Just checking for the base cast is not enough.

Change-Id: I455533b7da31cf5c52d8c1b9dd93b3bb2fb58929
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-16 15:30:29 +00:00
Christian Kandeler
9426ce99a1 ClangCodeModel: Fix providing virtual override list
... when the cursor is right before the opening parenthesis of a member
function call. The clang AST is different then.

Change-Id: Ibb75c15d2e28c2004b5ab2dd8fd3db0a2da88e56
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-14 13:30:27 +00:00
Christian Kandeler
4899e133c9 ClangCodeModel: Keep base declaration on top
... when presenting the list of virtual overrides, as we do in the
built-in code model.

Change-Id: I2598438f78cd9d9a7ddc1620391cea51d7e2da42
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-14 07:48:48 +00:00
Christian Kandeler
7275402ce9 ClangCodeModel: Fix links for virtual overrides
For some reason, clangd returns the declaration instead of the definition
position in the "Goto Implementation" result, so we have to do another
look-up for each override.

Change-Id: I2a99eb0dacdea07d5882087445dc2b2d61b24e58
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-11 13:57:01 +00:00
Christian Kandeler
27243bcfe3 ClangCodeModel: Do the "Go to Implementation" requests recursively
clangd reports only the first level of overrides.

Change-Id: I4aef7ca548a7a06fc7461994c3b750f9372aa738
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-11 05:35:58 +00:00
Christian Kandeler
eba2f2df84 CppEditor: Run test cases for virtual functions also with clangd
This uncovered some bugs, of which we fixed the ones that we could do
something about.

Change-Id: Id8494793bec4d25635bf920133d9f9331bd36228
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-08 09:51:09 +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
David Schulz
068873c9d5 Utils: add FilePath::baseName
Removing some FilePath::toFileInfo() calls

Change-Id: I49be2ef260f225e07b64ee8ace6a8cd47a9d8bb2
Reviewed-by: hjk <hjk@qt.io>
2021-06-03 11:23:35 +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
Christian Kandeler
b0d4fc359f ClangCodeModel: Let user choose the override
.... when following virtual function calls.
This brings us up to par with the built-in code model.
We do lose the icons, but they are of very little use in this context.

Change-Id: I29b27d538e7277d06a5af7acee07bddb6eb94c98
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-01 08:22:21 +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
David Schulz
f8ca730121 LanguageClient: Use Utils::FilePath to get file content
Change-Id: Iddb2eb5c02f3e6674f1f71bb61fb1f13dec22794
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-18 12:35:43 +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
hjk
2f593d9db9 LanguageServer: Use Utils::CommandLine in StdIOClientInterface
Change-Id: Ic2516387d7308bfad05cef54467c417cc47a7655
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-05-03 11:31:17 +00:00
David Schulz
1d7e05e6a9 LanguageClient: remove unneeded document actions blocker
Change-Id: Id1f07dbf83fcf7d75aaba6d860fb1556761bbd4b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-04-27 08:38:16 +00:00
Christian Kandeler
91b6c58518 LanguageClient: Add signal to inform about WorkDoneProgressEnd
... and make use of it in the clangd client to be able tell when
background indexing has finished.

Change-Id: I0f3c6f9646fd66ababd08c12b2f347da5f1a3729
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-04-27 07:37:25 +00:00
Christian Kandeler
90a07eca28 LanguageClient: Add the possibility to override progress messages
... and make use of it in the clangd client.
We want the progress bar for background indexing to have a better title
than the plain (and non-translated) "indexing" that the clangd server
sends.

Change-Id: Ib75eac370e7c22f0c5bd477f4a4c423283b27e1f
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-04-26 08:13:21 +00:00
Christian Kandeler
e27b367bdc ClangCodeModel: Introduce dedicated class for clangd LSP client
Makes sense for modularization purposes, and it will soon get additional
functionality.

Change-Id: Ie8163d352fc408b4167ee2ce6147aa1fb19528eb
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-04-22 12:07:49 +00:00