The clangdclient.cpp file is rather large, and the AST stuff is a nicely
self-contained chunk of code to move out.
No functional changes.
Change-Id: I0240413f561f5c67ca5ee310b5c4253ffa62fdae
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
This allows us to switch between headers and sources with different base
names and/or locations, using symbol matching heuristics.
Task-number: QTCREATORBUG-16385
Change-Id: I2d9c07f412d70b75322ed65d491982d78674483d
Reviewed-by: David Schulz <david.schulz@qt.io>
Clicking the lightbulb should bring up a menu if and only if there is
more than one possible action for this location.
Amends 089e1edcbf.
Change-Id: I45348ed4fbf9b3f32e19bbe17f0c2c030ecd24ed
Reviewed-by: David Schulz <david.schulz@qt.io>
It's not feasible to map every possible setting into our UI, so instead
teach people how to use the clangd configuration mechanism.
Change-Id: Id11e81e25b687a4f49af4e090203faca3a75722d
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>
According to the protocol a hover request can also return a Null as a
result. Reflect this in the protocol implementation and adapt usages.
Change-Id: I14ce71639c64b6de00e9c1198617083c1a3de9eb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Do not report quickfixes with a diagnostic since those are already
collected by the ClangdQuickFixFactory as builtin quickfixes.
Change-Id: I8d29a08b823291f8beaa762c09b7d29a4b9d0384
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Set the diagnostic to the containing code action when generating
refactor markers. This makes sure the light bulb is displayed at the
diagnostic and not the edit location.
Change-Id: I46ac7a19879d2358eb49f5cb1b695ee10a0c682d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
We basically forgot to implement this. A task in the issues pane was
created for every text mark, but there was no code to deal with handling
editor switches, resulting in seemingly random behavior.
Fixes: QTCREATORBUG-27260
Change-Id: Ifcc1e04db4c37dde7e80f0e1646dc7c557cd7481
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>
... rather than the one from the LLVM that Qt Creator was compiled
against.
Task-number: QTCREATORBUG-27120
Change-Id: I4f211345ed547cd13f0b0774b99bc0f199a9cd44
Reviewed-by: David Schulz <david.schulz@qt.io>
... when setting up the compilation database.
As it turns out, these conversions were the most expensive part of
creating the JSON file. We now build the JSON arrays incrementally
instead of setting them up from scratch for every source file.
Change-Id: I1e664a6320d5b3c49b31366c58aa14f63818e008
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
We needlessly re-evaluated the same compiler options again and again for
all files in a project part.
Now we only do the actual file-related work per file. Along the way, we
dissolved some unneeded classes and made CompilerOptionsBuilder non-
polymorphic.
Change-Id: I9710d641a57032936cc0812515974dbc91676c8c
Reviewed-by: David Schulz <david.schulz@qt.io>
This makes sure that the lsp filter gets enabled if a document is opened
before the corresponding clangd server was initialized. This happens
when loading a session with an open document.
Change-Id: I7987ea60c6fca8b5c070af3a7bcd5325667ed0c5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
If an AST node contains no file info, then we must use the one of the
parent node, in order not to create highlighting results for tokens from
other files.
Fixes: QTCREATORBUG-27384
Change-Id: I7c6f0c06063df9ce76feef333907d9d4f07a38e5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
... in output argument highlighting.
If there is not enough information for clang to determine the const-ness
of the argument passing (as it can happen in templates), do not report
an output argument.
Change-Id: I8d0143042f02ac44d8d971398014828cff14697f
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 need to relax the range check: In expressions such as x.y->z, the
second argument for the operator->call is x.y, not just y.
Fixes: QTCREATORBUG-27352
Change-Id: Ida542c11c129630f0a1d301508ec5f8076eb9902
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>
... in completions. Apparently, clangd uses the LSP type "property" for
static members.
Task-number: QTCREATORBUG-27289
Change-Id: Ib296dbade6b2e7c38a761b27b2c024ea98a89523
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
By setting QT_LOGGING_RULES=qtc.clangcodemodel.clangd.timing=true I can get
values like:
qtc.clangcodemodel.clangd.timing: highlighting: Start to end: 2953 ms
qtc.clangcodemodel.clangd.timing: ClangdCompletionAssistProcessor took: 7343 ms
The first tells you how long Creator took to turn clangd's semantic tokens into
full highlighting info, and the second how long it took for Ctrl+Space.
Change-Id: I99bd04c2889bb7da98c04537eab06d6ed6117167
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Unknown compiler flags are an unsuppressable error in clang.
But we do not want to maintain a blacklist of unsupported GCC and MSVC
options or a whitelist of supported clang options, as both would
constantly go out of date.
As clangd seems to work fine despite the error message, we simply filter
out this type of diagnostic.
Fixes: QTCREATORBUG-27113
Change-Id: Ib32601831eded60daf80eb0ca5cf01bbd71493fa
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
... as output arguments with clangd.
We might want to do so in the future, but right now it's not intended.
Task-number: QTCREATORBUG-27111
Change-Id: Ie6941f18943a1d6942901c526c62999cba6c1125
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>