Commit Graph

1581 Commits

Author SHA1 Message Date
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
hjk
e7c536011f Prefix Tr::tr contexts with ::
To make outliers better visible in Linguist

Change-Id: Ic35ea2a858b7e3576d9a416fb494fddb616eaaa1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-13 12:00:17 +00:00
hjk
33cdb052ba FilePathify some testing code
Change-Id: I3739a6eb3c2172078e9519e8186daf94ec74d99a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-13 10:46:13 +00:00
Eike Ziller
2688a9629c Merge remote-tracking branch 'origin/9.0'
Conflicts:
	src/libs/utils/pathchooser.cpp
	src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp

Change-Id: I7ae3f91618c4a4ccb088679caea72b2a81590960
2023-01-13 09:16:25 +01: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
David Schulz
baa1e3c2e1 Editor: Allow to hide annotations for a group of text marks
The hiding is not persistent, so on the next Qt Creator start all
annotations are visible again. This is meant to quickly get rid of
annotations if there are to many irrelevant of a specific kind.

Change-Id: I4862e56e0f5624f30aadda26efc9dea672ab1f57
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-12 10:19:10 +00:00
Jarek Kobus
14a70e1514 Clang: Use multi-arg for strings
Change-Id: Ia0cd1abdb59cd35f1ff276811386a57bcfeefa5f
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-01-11 11:43:55 +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
91b5274276 ClangCodeModel: do not highlight tokens as Text
Fixes: QTCREATORBUG-28639
Fixes: QTCREATORBUG-28637
Change-Id: Idfcfc6c61db9d5449ab14eda566ce704160bac54
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-11 09:29:27 +00:00
Jarek Kobus
7ef8d8313d ClangDiagnosticConfig: Introduce ClangToolType enum
And reuse it where applicable.

Change-Id: If75f849ac936ef2c67b35c6a78d5bb055fc172d2
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-11 09:14:17 +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
4e9c1d126c Replace GPL-3.0 with GPL-3.0-only
GPL-3.0 is deprecated by SPDX.

Change done by

 find . -type f -exec perl -pi -e 's/LicenseRef-Qt-Commercial OR GPL-3.0(?!-)/LicenseRef-Qt-Commercial OR GPL-3.0-only/g' {} \;

Change-Id: If316a498e3f27d2030b86d4e7743b3237ce09939
Reviewed-by: Lucie Gerard <lucie.gerard@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-10 08:05:04 +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
hjk
e42d24fca9 CppEditor: FilePathify some of the refactoring operations
... and adjust surrounding code.

Change-Id: I1d36e5a0c6ba14a1d9b8fd59340f1bb2a1e45ad1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-16 14:27:50 +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
Christian Kandeler
8d17762bb0 ClangCodeModel: Use newly implemented clangd support for operators
We now get a semantic token "operator" from clangd;
see https://reviews.llvm.org/D136594.
As a side effect, this results in the following subtle changes in what
exactly gets highlighted, both of which make sense:
    - The type part of a conversion operator is now highlighted as
      a type, not an operator.
    - We no longer add special highlighting for the brackets in
      operator new[] and operator delete[].

Change-Id: Ic149487496768762728a712c9fbcde5c9516529c
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-12-13 09:38:34 +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
Christian Kandeler
4c1b3c863c ProjectExplorer: Add "Generate" sub-menu to build menu
Preparation for adding more generators.

Task-number: QTCREATORBUG-28149
Change-Id: I4afa183a6fbd8ee88fc978b382f28cf9e52f09e9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-12-08 14:34:52 +00:00
Jarek Kobus
f9800bb790 ClangTools: Pass context object to lambda connections
Remove some unneeded lambda () brackets.

Change-Id: I502eb5cd89505fb77c02abf44b7ce19541a8ac2f
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>
2022-12-08 13:46:41 +00: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
David Schulz
0bd6d7a69f LanguageClient: move completion rerequest logic
...from the code assistant to the language client specific assist
implementation. This further reduces the complexity of the code
assistant.

Change-Id: I08ba5eecea826d3ccfe7f1f5a8791a085299d6ef
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-11-29 06:04:30 +00:00
Orgad Shaneh
157f2bcd39 Merge remote-tracking branch 'origin/9.0'
Change-Id: I231d35f492713f317773b79478b5f7fb97a4fe50
2022-11-28 17:29:19 +02:00
Christian Kandeler
aed633712f CppEditor: Prevent /TC and /TP with Objective-C files
This is relevant when clang-cl is used to compile Objective-C projects.

Task-number: QTCREATORBUG-28369
Change-Id: If8ae4dfaa07bf2ec81fbbec358663617c430b9e2
Reviewed-by: Frederik Seiffert <frederik@algoriddim.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-11-28 12:32:41 +00:00
Christian Kandeler
ed06978830 ClangCodeModel: Switch off clangd persistently
... after failed machine suitability check.

Fixes: QTCREATORBUG-28441
Change-Id: Ic0fb956168204d8023ff96f92ae3fcd7cea8b0e9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-11-28 10:43:43 +00:00
hjk
038771051d CppEditor: Switch to FilePath in IndexItem
... and fix fallout.

Change-Id: I45d27146806bdcb5ceb728b710eca51c7cd32ee2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-11-25 11:16:38 +00:00
Christian Kandeler
0f202ea724 ClangCodeModel: Restrict opening non-project files to headers
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>
2022-11-25 10:21:21 +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
918c7ca52d ClangCodeModel: Make use of new clangd token type "modifier"
See https://reviews.llvm.org/D137943.

Change-Id: I313576b32fff1c9ba44e3753e3f02cdd34e2ea3e
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-23 09:52:33 +00:00
hjk
fa1adf4d40 CPlusPlus: Proliferate FilePath use
The starts with CppDocument::filePath(), plus a bit of the fallout

This is one patch of potentially many. It is hard to draw the
line where to stop this kind of chunk, this here converts a few
additional functions for which including it in the patch looked
like less churn than without.

Converting is mostly fromString/toString, with a few exceptions
for "already seem" like caches, that use cheaper "path()" to
avoid likely performance regressions (on Windows FilePath
comparison is currently case-insenstive, and more expensive).

There should be no difference for local operation with this patch.

Change-Id: I7b35f98a0a6f0bfed4ea0f8f987faf586f7a8f2b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-22 15:30:00 +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
Jarek Kobus
3caf82f746 Remove unused includes of Q[H/V]BoxLayout
Change-Id: Ia90b30b634281414268e00722771470f1e7b69c0
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>
2022-11-18 15:29:06 +00:00
Christian Kandeler
953000b981 CPlusPlus: Add new usage tag "Template"
For use in follow-up patch.

Change-Id: I49c057280be9b09862a89fa385a7396f1b1093bb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-11-17 15:02:09 +00:00
David Schulz
0e4b0a26d3 Editor: move ownership of assist interface to processor
This way the base class can manage the lifetime of the interface object
and it doesn't need to be done in each implementation of perform.

Change-Id: Ie1ce742e31b688a337533ee6c57d376146e25ace
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-17 13:23:55 +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
Eike Ziller
3f0f9a63c0 Merge remote-tracking branch 'origin/9.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/clangcodemodel/clangdcompletion.cpp

Change-Id: Iaa92bf057d7696d2da10802ff95e80863f3235d8
2022-11-14 15:26:20 +01:00
David Schulz
09ee528c40 Editor: unify assist processor handling
Define the run type of the processor by its implementation instead of a
enum value of the provider. The execution of a processor inside the
assist now follows a unified procedure.

Change-Id: Ibe9fab324c6072e77702c2663946d7a9f562a085
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-14 13:02:51 +00:00
David Schulz
574d64436a ClangCodeModel: fix memory leak
amends 45317da25a

Change-Id: I27d3332f1a99676c174f18ff06d0cf0cea396b70
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-11 12:08:37 +00:00
Eike Ziller
10dca6b37f Merge remote-tracking branch 'origin/9.0'
Change-Id: Ie069f3b2a1200b3e665341b1d56ce836024b0d29
2022-11-10 13:22:43 +01:00
Christian Kandeler
45317da25a ClangCodeModel: Auto-start header file completion on trigger characters
That is, recognize '"', '<' and '/' as activation characters, like the
built-in code model.
Note that we do not actually start the LSP completion procedure for
these unless we really are in an #include directive.

Fixes: QTCREATORBUG-28203
Change-Id: I85727d0e392a27efa8549e7d6fa5f18f953774b4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-11-09 14:49:33 +00:00
Christian Kandeler
f93c316b73 ClangCodeModel: Adapt to new upstream feature
See https://reviews.llvm.org/D130015.

Change-Id: I2c2590265f2d7a2c2b5e966b0dc65ceff6b1b3e6
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-11-08 14:21:25 +00:00
David Schulz
08002c6278 Editor: delete assist interface in lsp/clangd support
The complete memory management in the code assistant needs an overhaul.
For now just delete or at least track the assist interface with scoped
pointers.

Fixes: QTCREATORBUG-28408
Change-Id: I0bd4cfaa36a660b6fd5bb467af3b13414ed76e63
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-11-08 12:07:56 +00:00
Christian Kandeler
074126cf47 ClangCodeModel: Fix usage type of constructors in "Find References"
In particular, in a variable definition, the (invisible) reference to the
constructor is *not* a declaration (but an implicit call).

Change-Id: Ic1f29a4da360959e81ec536efbf1175924ea34d7
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-11-08 10:53:25 +00:00
Christian Kandeler
c4ee485bdf ClangCodeModel: Fix persistent SwitchDeclDef object
If both AST and document symbols are available right away, the
ClangdSwitchDeclDef object emits its done() signal before it is
connected and stays around, potentially firing off new "follow symbol"
requests to the bewilderment of innocent users.

Fixes: QTCREATORBUG-28183
Change-Id: I972c8d4d9d7b7435e293d76fe710b19c9c4fb287
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-08 08:14:37 +00:00
Christian Kandeler
3e3569f6dc CPlusPlus: Add more usage tags
To be used in subsequent patches.

Change-Id: Id7140aa39bb2adba343cc12b0273c90f3c12abeb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-11-07 13:24:58 +00:00