Commit Graph

311 Commits

Author SHA1 Message Date
Christian Kandeler
6500a250fc ClangCodeModel: Suppress more clang warnings about unknown arguments
E.g. some instances of drv_unknown_argument have now become
drv_unknown_opt_for_target.

Change-Id: I5df7f25c4efcaaa38ac0d9ffcd53f3467798a604
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>
2023-06-08 08:30:06 +00:00
Jarek Kobus
a3a5b8f806 Utils: Rename asynctask.{cpp,h} -> async.{cpp,h}
Follows AsyncTask -> Async rename.

Change-Id: I37f18368ab826c9960a24087b52f6691bb33f225
Reviewed-by: hjk <hjk@qt.io>
2023-05-03 13:24:20 +00:00
Eike Ziller
2bc37de42b Merge remote-tracking branch 'origin/10.0'
Conflicts:
	src/plugins/python/pipsupport.cpp
	src/plugins/qtsupport/exampleslistmodel.cpp
	src/plugins/qtsupport/examplesparser.cpp
	tests/auto/examples/tst_examples.cpp

Change-Id: I00273622423fa99d41621969f6ecbbdaa0e18664
2023-04-13 15:59:08 +02:00
Christian Kandeler
02f2a93503 ClangCodeModel: Let clangd handle cuda sources
Fixes: QTCREATORBUG-28984
Change-Id: I7fbf5a671ff6f1d1ecd928d9be1f619dc32563a9
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-04-13 11:35:22 +00:00
David Schulz
4d688c932b Clangd: do not modify the default replacement string
Fixes: QTCREATORBUG-28321
Fixes: QTCREATORBUG-28910
Change-Id: I4cfaf5ea3916a0ecbf0b0bae4d0c231513671c73
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-04-04 08:55:15 +00:00
Christian Kandeler
3c0c26f7b3 ClangCodeModel: Adapt to updated clangd tooltip format
The header file path is not the last line anymore;
see https://reviews.llvm.org/D146244.

Change-Id: Ifbc2b55c0a82c661454d487c287fe4fb5a950d38
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>
2023-04-04 08:53:57 +00:00
Christian Kandeler
0319542937 ClangCodeModel: Do not try to rename macros and namespaces with clangd
Unfortunately, clangd refuses to rename macros and namespaces.
Fall back to our old two-stage "find + replace" approach for macros
(which clangd can find just fine) and employ the built-in code model for
namespaces (as they don't get indexed at all by clangd).

Change-Id: I08b1088ff4de9220427e089ef0700dbf2a944081
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-04 07:26:49 +00:00
hjk
305ccfe259 Utils: Replace FilePath::onDevice() by new FilePath::withMappedPath()
Basically a.onDevice(b) == b.withNewMappedPath(a), matching the order
of b.withNewPath(a).

Whether the (curretly docker-specific) path mapping is useful /there/, and
whether some of the calls are needed at all is dubious. I added some
FIXME and changed a few cases directly.

Change-Id: I7514736ce922f632f1f737bc496f6783389a42b6
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-04 06:56:55 +00:00
Jarek Kobus
af84305f12 DocumentLocatorFilter: Make it more self-contained
Hide public DocumentLocatorFilter::updateCurrentClient()
method and remove
ClangdCurrentDocumentFilter::updateCurrentClient().
Connect DocumentLocatorFilter internally into a new
LanguageClientManager::clientInitialized() signal instead.

Change-Id: Ie74a112bda811525b7d226da1377e5624130e9ed
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-03-20 12:35:01 +00:00
Jarek Kobus
d6f5d07639 ClangCodeModel: Use QtConcurrent invocation for async run
Change-Id: Id404d3a7699f12cdbc1e51390b3e5218ab3459b6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-03-09 11:21:33 +00:00
hjk
3e7d93c788 ProjectExplorer: Move some not-fully-session related bits
... out of SessionManager.

The idea is to later move SessionManager into the Core plugin,
which both is sensible conceptually and also prerequisite to
merge the Bookmark plugin into TextEditor plugin.

Currently, only the interface is split, as the load/save
implemetations are non-mechanical to disentangle.

Change-Id: I31631db3094ea192825a2ccaa6add6188662940b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-03-01 09:26:50 +00:00
Orgad Shaneh
6a0a4ac5e4 Merge remote-tracking branch 'origin/10.0'
Change-Id: Iff4973fc4116122bcaa7aa9434294dba875ef56a
2023-02-14 15:52:41 +02:00
Alessandro Portale
64aaf66c3b Proliferate Tr::tr in various places
This changes several tr() calls which were either missed during Tr::tr-
ization or were added later.

Found with regular expression: (?<!(Tr::)|([\w]))tr\(

Change-Id: I1c0c03589e941614a7a8449ecfebc7d2cad396c3
Reviewed-by: hjk <hjk@qt.io>
2023-02-10 16:27:19 +00:00
Christian Kandeler
a811afaeab CppEditor: Render forward decls less prominently in outline
Fixes: QTCREATORBUG-312
Change-Id: I9bb77add24737881eeee008620941b55118ee0e5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-02-09 08:59:25 +00:00
Christian Kandeler
cc52478a93 LanguageClient: Export LanguageClientOutlineItem
To enable more customizations by specialized clients.

Change-Id: I0ad92e248e931389c3fa239df424df8883e1d86e
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>
2023-02-07 12:01:31 +00:00
Christian Kandeler
e771560ec7 ClangCodeModel: Do not traverse the AST in the semantic highlighter
... with clangd >= 17. We do not need to look at AST nodes anymore;
everything comes from the server.

Change-Id: I46eb91f26515e31b752020edbc32f1b23c1d79c7
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>
2023-02-03 14:07:56 +00:00
Christian Kandeler
0d909c353c Designer: Update C++ code model on an object name change in designer
We try to locate the old symbol name in the generated ui header and
rename the symbol in the background.

Task-number: QTCREATORBUG-1179
Change-Id: Iaf68e3922cd728cbc87d0dc97125e34b8bdaa6be
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-27 10:02:52 +00:00
David Schulz
42d7304d2b ClangCodeModel: Allow cancelling the background index
Restarts the client with temporarily disabled indexing. The block is
reset after starting clangd, so any subsequent changes to the
configuration or the project will start the client again with indexing
enabled.

Change-Id: I16c975b6ef0b56f27ce5b2ced01f534f8ae0b4d3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-01-20 08:44:57 +00:00
hjk
117b6f1921 ClangCodeModel: Tr::tr
Change-Id: I60aeadd38471cc65de250f66f0f09ba2931b3da2
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-19 12:18:42 +00:00
David Schulz
15cf2ecf25 LanguageClient: Export ProgressManager
Change-Id: I737b7097878aacf9d1cf5b72af05b1471ab36891
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-01-17 13:22:21 +00:00
David Schulz
3677932266 ClangCodeModel: reuse Id for restarted clients
This is needed to keep annotations hidden after the restart of clangd if
the user disabled them in the text mark tooltip.

Change-Id: I69a668f2ba71f1dda83eca74a064af7ec1f92e77
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-01-12 14:45:12 +00:00
hjk
b87f0519e3 CppEditor: Use FilePath for ProjectPath::m_sourceFiles
... and update using code.

Change-Id: I682727a4b2982dba388e7cc7b9488225748d591f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-01-11 09:54:25 +00:00
David Schulz
a298e11e0c ClangCodeModel: map compile commands json path to server
Change-Id: I0129bb0688980f986012445f418d07f1e4cea6ae
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-01-10 09:08:13 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
Marcus Tillmanns
e603116abb ClangCodeModel: Remove unused variable
Change-Id: I06ab5d049db40c17e9b730b29934266445d5911f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-16 11:59:58 +00:00
Marcus Tillmanns
c0a692a96d Clang: Use clangd from build device
Change-Id: I41184ba267ac82a790835c94623c8b752679ab24
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-16 08:40:57 +00:00
David Schulz
2d0456f085 LSP: Support remote LSP file paths
Change-Id: If3cf1b8d675ef091427dbcd703c7d14b384a1b3a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-15 09:49:48 +00:00
Eike Ziller
af60fb8241 Merge remote-tracking branch 'origin/9.0'
Conflicts:
	src/plugins/cppeditor/cppelementevaluator.cpp
	src/plugins/vcsbase/vcsbaseclient.cpp

Change-Id: I31e03b063240416280f5ca88c31f432911d5c67e
2022-12-12 11:07:15 +01:00
Eike Ziller
d8343b4b46 Fix crash after closing preferences opened from indexing progress
The preferences dialog is modal and creates an event loop that would be
running within the mouse event handler of the widget. When the dialog is
closed after the widget is destroyed (i.e. after indexing finished),
control would be passed back to the destroyed widget, and crash.

Fixes: QTCREATORBUG-28566
Change-Id: I71efa683822b5682ad1b38c39ce8f73c89bdd610
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-07 09:26:10 +00:00
Marcus Tillmanns
7bb63f5b21 Clangd: Change the Log target to "Ui"
If the error messages of clangd are not shown in the Ui, it is very
difficult / impossible for the user to analyze problems when they
occur.

Change-Id: I81e2fc9aa999332147837adf54dfac49233e6f99
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-12-06 12:20:10 +00:00
hjk
83720540a1 CppEditor: Convert parts of ModelManagerInterface to FilePath
Change-Id: If7503b6d6732e1735eb8d48ece6e80886d10c647
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-29 12:27:10 +00:00
Christian Kandeler
bfecefabc0 CppEditor: Let users check for unused functions in (sub-)projects
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>
2022-11-24 09:27:03 +00:00
Christian Kandeler
0f2db176fa ClangCodeModel: Re-enable renaming via clangd
... for clangd >= 16, which has the configurable rename limit.
Still allow users to opt out for now.

Change-Id: I86d6809b66ffbf80245b61cf57c648842d2e17af
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>
2022-11-21 08:57:40 +00:00
Christian Kandeler
86770f28d0 ClangCodeModel: Keep a ref count for "extra files"
These are files that we temporarily report to the server as "open"
without actually having a document for them. Since this mechanism is
used in several places, we'd like to keep a consistent state even when
such actions overlap.

Change-Id: I0cfe3427740ec479926bc114848ad08f8866bdbb
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-11-17 13:15:03 +00:00
Christian Kandeler
a459ee5d24 ClangCodeModel: Re-enable renaming via clangd
The hard rename limit is gone, see https://reviews.llvm.org/D136454.
Make the feature opt-in for now, as we still need to do some UI fine-
tuning

Change-Id: Ic631a5b39711c6f37fffeeec4d2a5f5bf3bde92b
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>
2022-10-24 11:44:51 +00:00
Eike Ziller
638e73e4f8 Clangd indexing: Hide cancel button, open settings on click
Since we cannot reasonably "cancel" indexing, hide the cancel button
from the progress indicator.
Open the Clangd settings page when clicking on the progress indicator
instead.

Fixes: QTCREATORBUG-27744
Change-Id: I625464e7f7456bcf7f01ce7e52f6bd6b53e3d8b2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-10-19 06:24:54 +00:00
Christian Kandeler
b6a7666697 ClangCodeModel: Do not needlessly update the configuration
... of a document.
This fixes the indexing progress bar appearing when opening a source file
(unless it has editor defines set).

Change-Id: Ia99b226abdb1d5a98a92b23eb4d7311611940b0a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-10-13 13:27:22 +00:00
Christian Kandeler
48755cf7fd Revert "ClangCodeModel: Rename via LSP facilities"
We cannot use clangd's rename facilities yet, as there is a
hardcoded limit of affected files.
This mostly reverts commit 7dc2c6b3b3.

Change-Id: Ie441796569b533948cc028c867175d6f9d4b9d54
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-10-12 08:57:47 +00:00
Christian Kandeler
7dc2c6b3b3 ClangCodeModel: Rename via LSP facilities
Contrary to our original expectation, clangd's textDocument/rename does
not necessarily yield the same locations as /references. Instead, it can
find fewer or more occurrences, depending on server-side logic about what
constitutes a reference vs what should be renamed. Therefore, we need to
use /rename for proper behavior.

Fixes: QTCREATORBUG-27978
Fixes: QTCREATORBUG-28109
Change-Id: I27d092e807a4aa59dc0674111429c77ca13010e9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-10-06 11:09:57 +00:00
Jarek Kobus
95e54055ef Clang: Limit the usage of qMakePair and std::make_pair
Change-Id: Ida094760023047ecb8ba29e60d5e81f766981b65
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-04 08:45:28 +00:00
Eike Ziller
a254a9ba54 Merge remote-tracking branch 'origin/master' into work
Change-Id: I2235a55a599aaeca5d2b5377300a044b66c17da9
2022-09-29 12:03:13 +02:00
David Schulz
e2352f1cc0 Clangd: add setting for index priority
Change-Id: I5f9ea8c31747d1cd1e1e6b77ab7c705a7f275cff
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-09-28 12:16:13 +00:00
Christian Kandeler
c1e6307545 ClangCodeModel: Catch exceptions in semantic highlighter
I've repeatedly encountered std::bad_alloc recently, and would like to
get more info about where it is triggered. The crash comes from Qt,
apparently after the original thread has alresdy finished, so the
original location is not found in the stack trace.

Change-Id: I7bbdcce6534ea0c846a69af33ad8634c3415572d
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>
2022-09-27 07:55:49 +00:00
Christian Kandeler
9db286b3d6 CppEditor: Add actions for following a symbol to its type
Change-Id: I0b3913993b09b006e2d0431a68e98e21e8865898
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-27 07:55:21 +00:00
Christian Kandeler
813c6fbd81 ClangCodeModel: Implement following a symbol to its type
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>
2022-09-26 11:24:20 +00:00
Eike Ziller
e3f375925d Prefer project's Qt version for context help
To avoid additional dependencies, let the QtSupport plugin register a
function for filtering help URLs, and add information about the
originating file path to the help items created by the context help
handlers. The filter hook then finds out the corresponding project,
active target, and corresponding Qt version, and filters the help URLs
accordingly.

With the default setting in "Kits > Qt Versions > Register
documentation", only the highest versioned documentation set within a
major Qt version is registered, so context help now shows the highest
versioned help from Qt 5 or Qt 6 depending on active target. If that is
changed to "All", context help now shows documentation from exactly the
version that is currently used by the project.

Fixes: QTCREATORBUG-10331
Change-Id: I7d87793737cc5ab7d228ee4bfe568d7e8343ee7d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-26 09:24:55 +00:00
Christian Kandeler
644c438c3a ClangCodeModel: Try to find help items for method overrides
... in the base class.
This is purely a heuristic, but should work well for Qt-based user
projects.

Fixes: QTCREATORBUG-9845
Change-Id: Icca336b3568c2c5f07a9eaf6a183bf6c7c4275bd
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-14 11:21:38 +00:00
Christian Kandeler
f7efefb6d4 ClangCodeModel: Support setting additional preprocessor directives
... for a document.
This was only ever implemented for the built-in code model.

Fixes: QTCREATORBUG-20423
Change-Id: Ia99d0136e9995a5626058ad06173ea077be024d8
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-13 08:14:28 +00:00
Christian Kandeler
2fc5dba1c3 ClangCodeModel: Implement per-session mode for clangd
Fixes: QTCREATORBUG-26526
Change-Id: If9e018475b4e2f0557d9bf64ad9a7921c9dd6046
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-05 09:07:13 +00:00
Eike Ziller
04e50438eb Utils: Remove Utils::optional
Since we are now requiring macOS 10.14 we can remove our local
implementation of optional and use std::optional for macOS too.

Change-Id: I2bd018261b68da64f7f031a812045dd7784697e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2022-09-01 06:58:04 +00:00