- Made code more self-documenting.
- Added more comments.
- Added debug output.
- Rewrote ugly redundant code checking for #ifdef & friends.
- For consistency, emit update about ifdef'ed code only
if we also report the other highlighting results.
Change-Id: Idd3cbd3c169343bcaf6b6b19330130378ac6c5d0
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>
We failed to overwrite existing characters that match the completion if
clangd also changes "." to "->" at the same time.
Note that it still doesn't work as expected if the cursor is after the
dot and before the extra character. I'm not sure yet how to fix that.
Fixes: QTCREATORBUG-27034
Change-Id: I852145fc41f34ab60d9e944783e822bc9505453b
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>
When fast switching between clients listed inside the inspector
the message response for memory usage may arrive after the model
has been destroyed.
Change-Id: I0503bb334cf21b0919316f0ac2e731472f3433bd
Reviewed-by: David Schulz <david.schulz@qt.io>
There are some clangd settings that can only be provided via a config file
(i.e. neither via the command line nor via LSP extensions).
In addition, clangd is very picky about that file's location; in
particular, we cannot put it at the "pseudo project root" where our
generated compilation database resides.
Therefore, we have to go with a user config file (as we don't want to
write into any project source directories). If there already is such a
file, we don't do anything, based on the assumption that the user is
familiar with clangd and has already configured it to their liking.
Otherwise, we create the file, including a special marker that tells us
it was generated by us and can safely be overwritten.
The set of options we set is currently quite small, but we expect it to
grow in the future.
Change-Id: I1605bf7b0edecc844f3e7cdd1d7dddda7af33956
Reviewed-by: David Schulz <david.schulz@qt.io>
Contrary to our expectation, the "quickfix" tweaks are not part of the
inline code actions after all.
User-observable effect: "Populate switch" becomes available.
Amends 8b63dfccc6.
Change-Id: I4f7fa25a58bb54dbdb470d7db064b4d804c34d26
Reviewed-by: David Schulz <david.schulz@qt.io>
... if the client implementation requests it.
The server is not necessarily aware of our indentation style, so we
might have to apply it to the newly inserted code.
Change-Id: I43518575c7124568da42be3b04a28d7f352f6dc2
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>
Introduce an assist processor that merges our built-in quickfixes with
refactoring actions from clangd ("tweaks").
For now, we make it clear which ones are coming from clangd, and we do
not filter duplicate functionality. In the future, we might want to
disable redundant built-in actions if clangd is enabled for the
respective file.
Change-Id: I04842132798c8635dfddf8cfc98cc7a6313fac09
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>
... with clangd. More specifically, for the case where we switch between
declaration and definition of a destructor. Since clangd expects the
cursor before the "~" character, we move it there.
Fixes: QTCREATORBUG-26809
Change-Id: I8ea6a060bea3545c963cb8ebbe2d3ae3a18da2d5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... 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>
... 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>
Amends 825c9ea64f to work also for member access via pointer.
Change-Id: I8ee68d0f6d93c65c2f82a63bce5baef2aa2159de
Reviewed-by: David Schulz <david.schulz@qt.io>
The location of the blocks to marked ifdefed out are not tied to a
specific editor instance, but just depend on the document content.
Change-Id: I837730dc00e1d6060dd46bbb2cfccbfa5f72e6ce
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
If the cursor is right before the "." in a member access expression,
clangd interprets it as belonging to the member instead of the base
expression, which leads to unexpected behavior.
Work around this by sending a cursor position one to the left of the
real one to clangd in such cases.
Change-Id: I429ee9189760ccb02d231acfcb94ab6cfde3cd8d
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>
... when doing function call completion with clangd.
We did not take default arguments into account. E.g. the following
declaration:
void func(int i, int j = int());
was mis-detected as taking no arguments, causing to the cursor to be at
the wrong location afterwards.
Change-Id: I522921721b0cb347ed593c43ed285ca6d02ccfee
Reviewed-by: David Schulz <david.schulz@qt.io>
... which we get from clangd's textDocument/references.
This works around https://github.com/clangd/clangd/issues/935.
Fixes: QTCREATORBUG-26574
Change-Id: I3933f30fdaca024a6e240bd0962de3d97acd0dbf
Reviewed-by: David Schulz <david.schulz@qt.io>
... 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>
We need to manually refresh the documents that include the generated
header, as clangd does not know about it.
Change-Id: I8c4303ac029bbb56c01aa99b7950dcc651701678
Reviewed-by: David Schulz <david.schulz@qt.io>
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>
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>
We have some additional handling with the completion items that might
interfere with the snippets.
Change-Id: I86405ec67af189d01c8a4dfa468f56035e6e69c4
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This can now happen due to the newly implemented refresh support.
Change-Id: If64feede84b044140f7ec04e317289d3f493aa53
Reviewed-by: David Schulz <david.schulz@qt.io>