... when doing a decl/def switch via clangd.
The delay is fine for e.g. populating the outline, but shouldn't be used
when dealing with explicit user requests.
Change-Id: I0350ed6daf8220ec3b702a3876fbf0f726da8a67
Reviewed-by: David Schulz <david.schulz@qt.io>
The interface can be used for checking the context of a codeassist
request to determine
the correct processor that has to be created.
Change-Id: I47ddb05c46399566e27bae21711f11a3a4132c3f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
The pure LSP-based implementation is too inflexible with regards to
activation characters.
Change-Id: I386a60b80f59e1b48254d55c2a47f1a1ffe1f97f
Reviewed-by: David Schulz <david.schulz@qt.io>
Removes a pseudo-abstraction and simplifies ClangdClient.
Change-Id: I5161d069371ff92a517866bb7500517cab6781b7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... in "Find References".
This was broken in d6acd21fc0.
Change-Id: I0a185a8440bd5260b7cc18a87cefb450be71e77f
Reviewed-by: David Schulz <david.schulz@qt.io>
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>
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>
ProjectInfo, ProjectPart and ProjectUpdateInfo used to carry pointers
to Project and/or Toolchain, even though they were used in contexts
where these pointers were either unsafe to access or not guaranteed to
be valid anymore, which made their use difficult and error-prone.
We turn these classes into pure value types by copying in all relevant
information before the first async operation takes place.
Fixes: QTCREATORBUG-25678
Change-Id: I1914b0dbda6c7dfba6c95e5e92f2d69977755590
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
.. after receiving diagnostics since the code actions are already
inlined into the diagnostics.
Change-Id: I11ed1270344ff5119dd111503d173eef2f340c1d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
QTextCursor's understanding of a "word" does not always correspond to
what will actually be searched for (e.g. "operator+").
By doing a symbol info request first, we make sure that the string
displayed to the user in the search widget is really what clangd is
searching for.
Change-Id: I8be6e6122e5ed76334c4e6fc5b41debed96b6a40
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
These were still being served by the old code model even when clangd
support was enabled.
Change-Id: I5f01b6a7071b90c374750f93435299755cabe3e9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... if they have been properly opened in the meantime.
This fixes the problem that when a file was opened indirectly via "Go to
definition", the didClose message for the file that we temporarily opened
to search for overrides sometimes came in after the "regular" opening of
the file. As a result, such files were not actually in clangd's open
documents set, and no functionality was available for them (e.g. F2 on a
symbol would do nothing).
Also remove a left-over related declaration.
Change-Id: I9fc85d95595cb38a8d92e3f46505b9c514537d21
Reviewed-by: David Schulz <david.schulz@qt.io>
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>
Note that we used to encode the information about symbol visibility and
static-ness in the icons, which we can't do anymore, because clangd does
not provide this information.
On the upside, this change likely fixes a ton of bugs, as our own outline
was rather "quirky".
Change-Id: I099f11ec4e3c6f52cd461fb43080bbdde3bed5e5
Reviewed-by: David Schulz <david.schulz@qt.io>
Users no longer have to re-load a project for settings changes to take
effect.
Change-Id: I86dccccac14a30514c8dac292c7765ee4806f6ba
Reviewed-by: David Schulz <david.schulz@qt.io>
Users might want to use clangd for certain project, but not for others.
Change-Id: Id29ce3349f0acd359cf7c824ece073b147ed2280
Reviewed-by: David Schulz <david.schulz@qt.io>
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>
The AST is only needed for virtual function disambiguation, while the
basic functionality works fine without it. So in case clangd fails to
retrieve the AST node for some reason, just use the original "go to
definition" result.
This also makes "Follow Symbol" work with clangd < 12.
Change-Id: I2c110e9a51b01dc912fcdf6f4ed45fce766df374
Reviewed-by: David Schulz <david.schulz@qt.io>
This is particularly interesting for indexing, where users might prefer
a slower-building index with less CPU load.
Change-Id: Id44c58e9041df2857cd0772e71345673b14623f3
Reviewed-by: David Schulz <david.schulz@qt.io>
It is conceivable that users don't want to spend the extra CPU time on
this.
Change-Id: Ic3611c8d17d201ae986fad08b344369a8728ce1b
Reviewed-by: David Schulz <david.schulz@qt.io>
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>
... 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>
We somehow forgot to add the corresponding mime type to the language
filter.
Change-Id: Idefe2ed1dfe689340dabcf98363b3d160168000b
Reviewed-by: David Schulz <david.schulz@qt.io>
... 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>
... 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>
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>
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>
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>
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>