Commit Graph

191 Commits

Author SHA1 Message Date
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
Jarek Kobus
e22d79fbb5 ClangModelManagerSupport: Drop namespace scopes
Change-Id: Id8d9474a35e367469b435d10b3eba0700dffc304
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-05 10:48:54 +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
Eike Ziller
c7e94d80c7 Merge remote-tracking branch 'origin/10.0'
Conflicts:
	src/shared/qbs

Change-Id: I33e13270c8c15a51b4ce4eaa6b4584041ed124e0
2023-03-13 12:30:04 +01:00
Christian Kandeler
b63713a84f ClangCodeModel: Prefer clangd's switch header/source
It's more reliable than the built-in code model with non-trivial
directory layouts.

Fixes: QTCREATORBUG-28878
Change-Id: I02a058e7efb54e6af0998948a20d990e10293f03
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-03-10 12:55:26 +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
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
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
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
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
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
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
Orgad Shaneh
157f2bcd39 Merge remote-tracking branch 'origin/9.0'
Change-Id: I231d35f492713f317773b79478b5f7fb97a4fe50
2022-11-28 17:29:19 +02: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
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
David Schulz
938e9cab0f ClangCodeModel: fix null pointer access
Change-Id: I2c9e4dc04b7b27986eb0a3a74d8fa6879715df87
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-10-19 12:25:55 +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
Christian Kandeler
a33b37bfaf ClangCodeModel: Restart clangd on "internal" changes to non-open files
Our previous "openExtraFile" approach does not reliably trigger re-
indexing.

Task-number: QTCREATORBUG-26521
Change-Id: Ibb4008d9cc72afddf6709c6f9442426440b72d01
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-14 08:00:31 +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
Lucie Gérard
a7956df3ca Use SPDX license identifiers
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>
2022-08-26 12:27:18 +00:00
Eike Ziller
64247bf571 Merge remote-tracking branch 'origin/8.0'
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
2022-08-19 12:48:27 +02:00
David Schulz
b39c7cd782 CppEditor: remove unneeded indirection for the outline model
Change-Id: I01e9fb0dae30d6df22c0f5d7255ab247c48749fc
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-08-16 07:53:41 +00:00
Christian Kandeler
93fbef4de6 ClangCodeModel: Consider the case of a restarted client
We must not assume the initialized() signal comes only once.

Task-number: QTCREATORBUG-27596
Change-Id: Ife19657b7e0701a0e0dc10806e230bd1744a20aa
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-10 11:14:39 +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
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
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
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
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
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
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
David Schulz
9c13db448b CppEditor: remove unused function hint provider
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>
2022-06-13 12:11:24 +00:00
Christian Kandeler
a167bd9ad2 Do not pass Utils::LinkHandler by rvalue ref
There is nothing special about this type that justifies it sticking out
everywhere it appears.

Change-Id: Iccdc95163d477db8a031d0d520f28fea26432a44
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-06-07 09:22:30 +00:00
Christian Kandeler
5693c518bc Utils: Rename ProcessLinkCallback to something less clumsy
Change-Id: Icce4995f4aa886524dc3eedb7cf9ba72adbe8783
Reviewed-by: hjk <hjk@qt.io>
2022-06-03 13:23:28 +00:00
Christian Kandeler
01ceb3a3cb ClangCodeModel: Switch to LSP-based UI header approach
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>
2022-06-02 11:29:14 +00:00
Jarek Kobus
8cd9a2dd12 ModelManagerSupport: Get rid of UsagesCallback from findUsages()
It's not used currently.

Change-Id: Ic3625b0f3c53c09089a361453f29ac639692cffb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-06-02 08:52:55 +00:00
Jarek Kobus
b9f0663741 ModelManagerSupport: Get rid of UsagesCallback from globalRename()
It's not used currently.

Change-Id: Id859251f69abf33de3431d1e8b561aedefbb4651
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-06-02 08:41:33 +00:00
Artem Sokolovskii
6b8277fcd2 ClangTools: Remove foreach / Q_FOREACH usage
Task-number: QTCREATORBUG-27464
Change-Id: I1c4711d87e5f95fc1653dd9aa6448b105d017435
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-24 08:02:52 +00:00
Christian Kandeler
760cf632af Move clang diagnostics config settings to clangd settings page
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>
2022-05-23 12:15:40 +00:00
Christian Kandeler
70ec0cfff1 ClangCodeModel: Make use of clangd's "switchSourceHeader" extension
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>
2022-05-19 09:54:34 +00:00
David Schulz
59a77a4965 TextEditor: add text cursor to assist interface
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>
2022-05-13 09:18:53 +00:00
Eike Ziller
ff83642681 ClangCodeModel: Use Utils::runAsync instead of QtConcurrent::run
That works the same with Qt 5 and Qt 6.

This reverts commit c1fcaa2877.

Change-Id: I603e50c793c2477454253a57bfe01eb25ecab6e3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-12 11:00:51 +00:00
Christian Kandeler
35963fd2b8 ClangCodeModel: Fix issue pane management for clangd diagnostics
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>
2022-05-12 10:29:31 +00:00