We cannot tell clangd to opt out of indexing for certain files, so we
must prevent "foreign" sources from ever getting opened, or we will have
strange effects in the case of non-unique symbols.
Note that there are more (upstream) problems in this area, but this
patch limits the damage at least.
Amends 8ad7ab2d2a.
Fixes: QTCREATORBUG-28452
Change-Id: I131be699a35da8eacea6415c630e9012cc905a47
Reviewed-by: David Schulz <david.schulz@qt.io>
Note that especially in C++, there can be a lot of false positives,
especially in template-heavy code bases. We filter out the most notorious
offenders, namely:
- templates themselves
- constructors and destructors
- *begin() and *end()
- qHash()
- main()
Since the code model does not know about symbol visibility, the
functionality is quite useless for libraries, unless you want to check
your test coverage.
The procedure is rather slow, but that shouldn't matter so much, as it's
something you'll only run "once in a while".
Fixes: QTCREATORBUG-6772
Change-Id: If00a537b760a9b0babdda6c848133715c3240155
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Making use of LSP's "Go To Type Definition".
Just the backend for now, UI to follow.
Change-Id: Id73b2cf701eab03913477f6d4d3093e257e80dbd
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reverts/comments out parts of 45f93a817a,
which needs to be resolved in a follow-up commit.
Conflicts:
cmake/QtCreatorIDEBranding.cmake
qbs/modules/qtc/qtc.qbs
qtcreator_ide_branding.pri
share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
src/plugins/clangcodemodel/clangmodelmanagersupport.cpp
src/plugins/cmakeprojectmanager/cmakesettingspage.cpp
src/plugins/python/pythoneditor.cpp
src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
src/plugins/scxmleditor/common/colorsettings.cpp
Change-Id: I7f0f7b7120e75a9fc3a8886bc57c17345cbb501b
This amends 96be267a6e, which contained a
wrong assumption: Just because a ClangdClient has an associated project
does not mean that all documents currently open in this client belong to
its project. The opposite often happens at session loading. For example:
- We load a session with two projects.
- Qt Creator restores the documents and starts loading the projects.
- The latter happens asynchronously and takes longer, so initially
the fallback client claims the documents.
- The smaller project finishes first and now grabs all the open
documents whose files belong to it, as well as those that don't
correspond to any project (as per
8ad7ab2d2a).
This includes all documents belonging to the second project,
because that one has not finished loading yet, so its files are
not associated with a project at the moment.
- Finally the second project finishes loading. Now we must
"steal back" all its documents that are currently open in the
first ClangdClient. This is what this patch does.
We also now explicitly close the document in the previous client as part
of the hand-over, which is conceptually the right thing to do and should
eliminate any potential "ghost diagnostics".
Change-Id: I3d9f5ce503cc7ee47ece757d81851b85a16b639d
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>
As per 8ad7ab2d2a, we prefer to open non-
project sources in a project-specific clangd, rather than the fallback
client.
However, we do *not* want clangd to open files from "foreign" projects.
Checking for the existence of a client for a specific file is not enough,
as we might be in the process of loading a session or the respective
project might have clangd turned off.
Change-Id: I2d5cb7027c6a3ad23e99606d6d6742d67fbc5384
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Turn off clangd by default if we think the system does not have enough
memory. Inform the user and let them override our decision.
Task-number: QTCREATORBUG-19297
Change-Id: Ib9715c2f089c10d7a2a559a25180e9a943c118b1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Since we removed the libclang based backend both implementations of
ModelManagerSupport::functionHintAssistProvider returned a nullptr.
Change-Id: I113c5a08cf604eb1bb2a64a851f022ecd5c908d6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Generating ui headers in a well-known path and then including that one
in the compilation database does not work in the presence of multiple ui
files with the same name.
As it turns out, we don't have to generate any files at all; instead, we
pass the file contents directly to clangd, which then uses them when
parsing includes of the respective header.
User-visible behavior change apart from the abovementioned bug fix:
Tooltips and "follow symbol" on the include directive now always use the
actual location of the header provided by the build system.
Fixes: QTCREATORBUG-27584
Change-Id: I6b13e12cb3a365199567b0bc824d12b373117697
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
It was confusing to have both "Clang Code Model" and "clangd" project
settings pages, so we merge them.
Along the way, a lot of code dropped off.
Change-Id: I780850b716195c3729403ae59f0794c11b5c556d
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>
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>
This will allow us to request assistance for a specific selection
instead of just the position.
Change-Id: Ib8e5b32d4a8f2936e5a6f1b7ac968d7f1d8d9de6
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>
Stop pretending to be super generic. Instead, let interested code know
directly whether a document is under clangd's control.
This saves code and makes the logic easier to understand.
Change-Id: Ia19d0ec6c4e83926379a7d17ca53896bee3a50e1
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>
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>
... and "switch between declaration/definition".
It's either clangd or built-in code model now.
Use the opportunity to dissolve the pointless FollowSymbolInterface
class hierarchy, which introduced a confusing parallel inheritance
chain.
Change-Id: I792ad55656c5dd9f10c6b4db7c5c36cf7be45125
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
With huge source files it might not be so useful to continuously
recompile them while editing, which is basically what clangd does.
Let users opt out.
Change-Id: If3e95c1e286090606a84961d071179f8b40f9180
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>