Commit Graph

1332 Commits

Author SHA1 Message Date
hjk
c68f901aa8 TextMark: Delay context menu tooltip action creation
Change-Id: I25bad9a774a6d95162251c8f0512eb3f8439d9ae
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-04 12:58:12 +00:00
Christian Kandeler
321fae46f6 LanguageClient: Support limit parameter for completion request
... and make use of it in the ClangCodeModel tests.

Change-Id: Ib2186273aec1db9b354892c2e1c4ebd82e3c1c96
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-08-04 12:05:18 +00:00
Christian Kandeler
038835b024 ClangCodeModel: Remove redundant clangd version check
This was forgotten in 780f89b377.

Change-Id: I645e96bafcb2d431e74a7f203e911bbb062fb747
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-04 12:04:59 +00:00
Christian Kandeler
364208d202 ClangCodeModel: Move finding local references to a dedicated class
Change-Id: I5be08b58f4481df462f0ec664687a2c9f141f8b6
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-08-04 11:44:19 +00:00
Marcus Tillmanns
a251126485 warnings: Fix unused/unnecessary lambda capture
Change-Id: I1d0ed78da53c56f0a87bf35b1ee2480f9dfd330c
Reviewed-by: hjk <hjk@qt.io>
2022-08-04 10:22:29 +00:00
Christian Kandeler
c9b1e3a744 ClangCodeModel: Remove ClangModelManagerSupport::instance()
Not needed.

Change-Id: I46ee3a493ddb59c4b5f0e3eb4443d7f348a6b074
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-08-04 10:22:08 +00:00
Christian Kandeler
5fcb459d6b LanguageClient: Add LanguageClientManager::clientAdded() signal
For consumption by interested parties.

Change-Id: I0cbecb4ce99cdd208fc3ff019d4f0ea672dcf752
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-04 10:21:47 +00:00
hjk
ecb658e7fc ClangCodeModel: Avoid FilePath->QString->FilePath roundtrip
Change-Id: Ieb74aee5a6e8bfe8bdfe954d958e38da646fcb4d
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-08-04 05:11:01 +00:00
hjk
8ae55344de ClangCodemodel: Avoid repeated construction of category prefixes
Change-Id: I0166010a17f1f37855862f28cc9e2472b638c9de
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-04 05:06:34 +00:00
hjk
8a44294821 Merge remote-tracking branch 'origin/8.0'
Change-Id: Iea4fd2949f5d5345802e2e7d9283d72c6c55f69f
2022-08-03 10:52:13 +02:00
Christian Kandeler
c6399adf48 CppEditor: Remove some virtual functions from ModelManagerSupport
These were never called via the base pointer.

Change-Id: Ib233d9e93d80b1fbcc09a5b7b07d9fa3b8615f66
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-08-03 08:27:58 +00:00
Christian Kandeler
2b8ac45071 ClangCodeModel: Move "find references" into its own class
Change-Id: If4dc9f7cb56b7f2e03e3d4622e616fb8486ddc92
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-02 11:48:22 +00:00
Christian Kandeler
2f169bdfcb ClangCodeModel: Make some ClangModelManagerSupport methods static
Change-Id: Ie34a89ae01783631c6482cff8d4866595e757be5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-08-02 11:21:16 +00:00
Christian Kandeler
240105f55f CppEditor: Clean up ModelManagerSupport creation
No need for "providers" etc.

Change-Id: I4ae9e8ecd6b3554711e002f233c13fd7758f01e4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-08-02 09:15:55 +00:00
Christian Kandeler
5f9c30cacf ClangCodeModel: Do not make clangd open all ui headers
This amends 01ceb3a3cb, where we failed to
consider the case of projects with lots of UI headers, which cause
excessive memory use by clangd with our current simplistic approach.
Instead, we now only open ui headers that are used by currently open
documents.
Note that this approach will fail for indirect includes via header files,
but people who do that do not deserve happiness.

Change-Id: I1ef2add701e0f13dc0da79267d3c1367c1b496cc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-02 09:13:25 +00:00
Christian Kandeler
a6d1f7594c ClangCodeModel: Fix documents getting opened in wrong clangd
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>
2022-08-02 09:10:37 +00:00
Eike Ziller
347e489d14 Merge remote-tracking branch 'origin/8.0'
Conflicts:
	src/plugins/clangcodemodel/clangdclient.cpp
	src/plugins/projectexplorer/kitmanagerconfigwidget.cpp

Change-Id: Id1454bfe8e4f283f3b06ac6945aced2975814161
2022-07-28 11:53:13 +02:00
Cristian Adam
230b98ce76 clangd: Add ability to change --limit-results
A user can set a value to the QTC_CLANGD_COMPLETION_RESULTS
environment variable which will be passed as argument to clangd's
--limit-results.

The clangd default value is 100.

Task-number: QTCREATORBUG-27152
Change-Id: Ic3e512a735fda1540b4f0ab56e39f9c5f0213e79
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-27 12:12:51 +00:00
hjk
df358c7833 ProjectExplorer: Remove unneeded #include in projectexplorer.h
And fix side effects.

Change-Id: Ib6f0c5618092f80204b409edec0a92004f2350d2
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-07-27 11:56:09 +00:00
Cristian Adam
86b8f68f78 clangd: make --limit-results configurable in Preferences
The default value is the clangd default value: 100.

Fixes: QTCREATORBUG-27152
Change-Id: Icb6c67645b33325da591cb360c17b3dd55fc60ad
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-26 17:28:23 +00:00
Eike Ziller
9328aaa835 Merge remote-tracking branch 'origin/8.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp

Change-Id: I1ed3dd86fe5b4b87e3015c41652f5d0fa16d7070
2022-07-25 09:25:00 +02:00
hjk
aed29ad8c3 Core: Remove #include <QMainWindow> from icore.h
Adapt users; also use dialogParent() instead of mainWindow() were
appropriate.

Change-Id: Ib60b118f05c986a70657446c5b2937074243bb5c
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-07-22 14:11:46 +00:00
Jarek Kobus
cfd002ebf0 SearchResult: Rename cancelled() into canceled()
Make it consistent with Qt American style.

Change-Id: I01a70f282d654d23f2341352cf4f6fea22aa49fa
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-07-20 13:17:36 +00:00
Oswald Buddenhagen
9841a10f35 GccToolChain: whitelist all -f* and -O* gcc options
there are way too many -f* options to catch all relevant ones.
my particular case was the linux kernel, for which passing
-mcmodel=kernel but not -fno-PIE caused a gcc error.
if any particular option causes trouble, it should be blacklisted
instead.

also handle -O* while at it; -Og comes to mind as a relevant one.

this follows 3b79fafb3 in spirit.

Change-Id: I5de56082b695205409a8e82de2cab0618e2806a8
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-07-20 12:26:48 +00:00
Eike Ziller
3ec87e37ee Merge remote-tracking branch 'origin/8.0'
Conflicts:
	src/plugins/todo/optionsdialog.cpp
	src/plugins/todo/todoprojectsettingswidget.cpp

Change-Id: I24ca90c2fc2cd707df901d42694df6d0e27d696d
2022-07-20 12:03:40 +02:00
Jarek Kobus
a91ff34836 ClangdFollowSymbol: Don't leak ClangdFollowSymbol::Private
Change-Id: Ic8486d832084ae700322f0696d7b7321f0daf35f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-07-19 09:05:02 +00:00
Christian Kandeler
5c341854e0 ClangCodeModel: Fix callback handling when following symbols
Make sure emitDone() is atomic with running the callback, so in case the
latter starts an event loop of its own, we won't be overtaken by
incoming signals, deleting the object from under us.

Task-number: QTCREATORBUG-27910
Change-Id: I586d7609974662bf391b12041f416aaa2a973ecb
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-07-19 07:44:18 +00:00
Christian Kandeler
bb3549a721 ClangCodeModel: Move completion code to its own set of files
Change-Id: Iad856881ace80896f4aceab3fbf129d7635de642
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-07-08 11:58:42 +00:00
Eike Ziller
10163afae0 Merge remote-tracking branch 'origin/8.0'
Conflicts:
	share/qtcreator/translations/qtcreator_ja.ts

Change-Id: I436b8f60971f11a5fb7962a57600ad075135f397
2022-07-08 10:21:30 +02:00
Christian Kandeler
1fb4737d0d ClangCodeModel: Move quickfix functionality to dedicated set of files
Change-Id: I7cc55afa7aa50ba584593457b6c1393794866c56
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-07-08 07:45:30 +00:00
Jarek Kobus
c17214c53f ClangClient: Receive done() signal only once
Before this change the done() signal was emitted 3 times
in a row. The reason was that first one was coming
synchonously from handleGotoDefinitionResult(), while
2 others were scheluded with queued connections.
So, the handler for done() signal was called 3 times.
The first invocation calls deleteLater() and clears
the pointer, while the object is still alive.
Before the request to delete later gets dispatched,
the 2 remaining done() emissions are dispatched,
so the handler is still called 2 times.

One possible solution would be to disconnect from
done() signal inside a handler. However, the done()
signal shouldn't be called many times, so this fix
ensures the done() is emitted only once.

This fixes the following prinouts:
"QCoreApplication::postEvent: Unexpected null receiver"
issued twice on every follow symbol interaction.

Amends 650bc260c6

Change-Id: I9b440a80386aca3462eda323e51a76696e53fa6b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-07-07 15:28:03 +00:00
Eike Ziller
f950a5d86c Merge remote-tracking branch 'origin/8.0'
Conflicts:
	src/libs/utils/terminalprocess.cpp
	tests/auto/qml/qmldesigner/coretests/CMakeLists.txt

Change-Id: Ifc5b37dadd46af752f0771a2685da1ac9a6260bd
2022-07-07 13:47:12 +02:00
Christian Kandeler
5d8e53038e ClangCodeModel: Fix "Find References" for operators
We broke this in 49bb40f19e.

Change-Id: Ifc18501745c4515899c57ea461305db0f9ed6662
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-07-06 13:30:39 +00:00
Christian Kandeler
0456643a86 ClangCodeModel: Use the correct language type options for MSVC
This was broken by our compiler command line optimizations, resulting in
"-x" rather than "/T" appearing for MSVC/clang-cl toolchains and causing
clangd to assume C instead of C++ for some files.

Change-Id: Ib98db88ac90e4e45a7016a7edcb80a279df372aa
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-07-06 13:05:29 +00:00
Jarek Kobus
650bc260c6 ClangdClient: Don't delete an object from its signal handler
Delete it later instead.

Fixes: QTCREATORBUG-27803
Change-Id: I1108a87bc762a7da690b8999c9e73e127d79d3c4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-07-06 12:40:57 +00:00
Christian Kandeler
96be267a6e ClangCodeModel: Prevent documents from getting opened in wrong clangd
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>
2022-07-04 13:05:06 +00:00
Artem Sokolovskii
0087bd492f Clangd: Fix autocompletion for old style SIGNAL and SLOT
Fixes: QTCREATORBUG-20737
Change-Id: If6d3c6ea5924537386eca81d90d4bb1e8f1a1466
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-07-04 10:33:37 +00:00
Eike Ziller
6c98721efc Merge remote-tracking branch 'origin/8.0'
Change-Id: I552d201d09d62d21655176467088c6e48b8a2fe2
2022-06-29 15:29:49 +02:00
Christian Kandeler
9cbe2439dd CppEditor: Do not highlight macros as preprocessor statements
Macros are used like identifiers; there is no reason why they should need
to have the same highlighting as a preprocessor directive.

Fixes: QTCREATORBUG-23548
Change-Id: I186befc06ccb36a00451fd707c41e3687a84af14
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-06-29 09:08:27 +00:00
hjk
9e363c6421 Add plugintr.h files to all plugins
Except FakeVim, which had it before.

for i in [a-eg-z]*/*.json ; do
    upper=${i##*/}
    upper=${upper/.json/}
    lower=${i%/*}
    trfile=$lower/${lower}tr.h

    cat << EOT > $lower/${lower}tr.h
/****************************************************************************
**
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/

namespace $upper {

struct Tr
{
    Q_DECLARE_TR_FUNCTIONS($upper)
};

} // namespace $upper
EOT

    git add $trfile

    perl -pi -e "s/(${lower}_global.h)/\1\n    ${lower}tr.h/"  $lower/CMakeLists.txt

    perl -pi -e "s/(\"${lower}_global.h\",)/\1 \"${lower}tr.h\",/"  $lower/$lower.qbs

done

Change-Id: I15ebbaaa9443c57b391b9e143f592d8a0c9208a9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-06-27 13:34:57 +00:00
hjk
2496ffe3ce Code cosmetics
Mostly unused #include's, also sort them or reduce scope.

A few namespaces, ...

Change-Id: I9ee71e07de7157c9942125672addf87dd41e78f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-06-24 14:44:13 +00:00
Christian Kandeler
67a08683d1 ClangCodeModel: Move a test over from unittest
Change-Id: Iac295216fff274fbe4a109477b1a4c2bd2c98d5d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-23 13:54:14 +00:00
Christian Kandeler
bbbae099a7 ClangCodeModel: Move decl/def switch functionality to dedicated class
Change-Id: Id583ac58933e35e979083311907331b627d3c067
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-06-21 13:28:55 +00:00
Christian Kandeler
1a3f915586 ClangCodeModel: Fix following virtual functions
Amends 79b8e5397d.

Change-Id: I8c4e3c7cb8cb26d51cdf77c15891110c6b213d46
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-06-21 13:28:41 +00:00
Christian Kandeler
ea868c8b46 ClangCodeModel: Check system for clangd suitability on first run
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>
2022-06-21 13:23:37 +00:00
Christian Kandeler
c3f55f6b50 ClangCodeModel: Fix "switch decl/def" for free functions
Fixes: QTCREATORBUG-27731
Change-Id: Ibab872b9d4ecedba097c91ca44d279a1bb8208b6
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-06-20 12:36:28 +00:00
Christian Kandeler
0fa349237d ClangCodeModel: Special rendering for deprecated completion items
We add the attribute textually and show a warning icon.

Fixes: QTCREATORBUG-2325
Change-Id: Icc0305a703e26c84095167087b30fa3456f97614
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-06-20 12:12:05 +00:00
Christian Kandeler
79b8e5397d ClangCodeModel: Prevent surprisingly late "follow symbol" reactions
It can happen under certain circumstances (high system load, overworked
clangd, ...) that "follow symbol" requests get replied to very late,
with the user having manually navigated to the target document in the
mean time or started doing something else entirely. In such a situation,
it would be disruptive if we were to jump to a symbol suddenly, stealing
the cursor from the unsuspecting user.
We now prevent this by aborting the "follow symbol" procedure if the
user does something else with the document.

Fixes: QTCREATORBUG-20878
Change-Id: Iea52db661e8ba634951b18654a94e4b90580f001
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-06-20 12:11:29 +00:00
hjk
2f54c9a364 Use new convenience function for clipboard contents
Change-Id: I4a856fa53e66d42bc5f08ee79c40ad071d2841bf
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-06-20 12:05:28 +00:00
Christian Kandeler
71b914b828 ClangCodeModel: Do not dump compile_commands.json into project dir
We can't know if it's safe to put there; e.g. we might overwrite an
existing one.

Fixes: QTCREATORBUG-27573
Change-Id: I928408996759aaccb84332fcf95cf43d7f3bf083
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-06-15 08:43:59 +00:00