Commit Graph

279 Commits

Author SHA1 Message Date
Christian Kandeler
0a058bb657 CppEditor: Consider symbol occurrences in comments
... when renaming.
For local renaming, we consider only function parameters.

Task-number: QTCREATORBUG-12051
Change-Id: I7948d69f11b97663c9bd747ae6241a82dd9bdd82
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-09-01 11:42:17 +00:00
David Schulz
a137f2b23d LanguageClient: cancel find link at requests on rerequest
This avoids triggering the callback if we already requested a find link
at for a different position. Additionally we also cancel the request if
the document changes or the cursor moves inbetween requesting the link
and receiving the response.

Change-Id: Iffc7b08012a649397e7ca7dfc99d314a1bbf19f7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-08-28 05:58:24 +00:00
David Schulz
512da70456 LanguageClient: fill workspace configuration response
There is already a way to programmatically set the configuration for a
client, take this into account when generating the response for a
workspace configuration response.

Change-Id: Id59b643eefc59732c856c356317764e6c54af69a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-08-24 13:48:35 +00:00
David Schulz
806e24138b LanguageClient: send out empty workspace configurations
... instead of an error when the server asks for the configuration even
if we do not provide a way to configure workspace configurations yet.

Change-Id: I0d330b47a12627af100bf9d9b1eec34a58d6471b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-08-22 13:42:37 +00:00
Eike Ziller
a490625394 Merge remote-tracking branch 'origin/11.0'
Change-Id: Ie4b1f249d1a5b7835022f367ee6b1c8a3c953f0b
2023-07-04 12:57:47 +02:00
Christian Kandeler
20cb9b6e69 ClangCodeModel: Do not call FilePath::exists() on random strings
Fixes: QTCREATORBUG-29356
Change-Id: I6f4d89a6823829a7ecf16200786621321fea61a5
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-07-04 08:36:40 +00:00
Eike Ziller
dff9e1463b Reduce usage of app_version header
Most information is available via Q(Core|Gui)Application.
Add an AppInfo structure for the things that are not.

This avoids that the information ends up duplicated and
hardcoded in the plugins, which is not needed or desired.

Change-Id: I4d565e75c42a7b8facafa90c27096ea49359215d
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-06-26 06:57:46 +00:00
Marcus Tillmanns
3b6da21eec LanguageClient: Fix showMessageBox
ClientPrivate::showMessageBox did not create new buttons for
each possible action.

Clicking "Close" would result in a crash as the box had
WA_DeleteOnClose set and we tried to call box->clickedButton()
after exec().

Fixes: QTCREATORBUG-29253
Change-Id: Icc5fff99686fbef928b8ef14449de646ff773b17
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-06-20 08:43:38 +00:00
David Schulz
95609551a1 Core: add aboutToSave and saved signal to IDocument
We need reliable signals that gets emitted when documents are saved to
inform the language server about the document state change.

Change-Id: I0a1e8a5317ae6984ff17d878952c74f69765e3f9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-06-15 07:19:39 +00:00
David Schulz
c547c8615f TextEditor: optimize setting refactor markers
emitting requestBlockUpdate is not for free so limitting it to blocks
that have changed improve the performance notable for documents with a
lot of refactoring markers.

Change-Id: Ie288a367d1d1d6a9f4359e37ff8486a1dfe36752
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-06-13 11:52:00 +00:00
Christian Kandeler
f0a1591035 ClangCodeModel: Adapt to new "inactiveRegions" notification in clangd
See https://reviews.llvm.org/D143974.

Change-Id: Iff6cc39f7c567feee1953fde1ca96a9aefec75d4
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-06-08 11:06:15 +00:00
Eike Ziller
deb974de05 Tr/LanguageClient: Add some comments, parametrize error message
Change-Id: Ifd7354c10d18c0df093908c1a240f254c679893a
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-06-01 06:25:52 +00:00
David Schulz
bc9e90f8b6 LanguageClient: add projects filter function
Can be used to filter projects get reported to the language client on
server startup and when a project gets opened.

Change-Id: I8cfbc45ecb5251fcaecf2c331a9f1eff966c8db1
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-05-24 08:50:44 +00:00
Eike Ziller
ee6789c523 Centralize a PluginManager::isShuttingDown() status
Instead of keeping track of this in plugins individually.

Change-Id: Ia2650f0f647d4a63d2010cef688aa56f6020c338
Reviewed-by: hjk <hjk@qt.io>
2023-05-23 07:19:42 +00:00
Jarek Kobus
a0f6e8dc04 Utils: Rename qtcprocess.{cpp,h} -> process.{cpp,h}
Follows QtcProcess -> Process rename.

Change-Id: I97235a9a40cb7fd52944515b7ab878d96528f919
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-04 05:52:26 +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
David Schulz
4b606ba9de LanguageClient: optimize cloning documents
Cloning the document that is needed to track the changes for the
language server is 3 times slower than just getting the whole original
document content and create a new QTextDocument with that content.
Presumably some additional information gets cloned that is not needed
for just the content tracking.

Change-Id: I4a7002b2ac97563f01dc3a67351b9363e9cc7b3f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-03-31 06:38:37 +00:00
Robert Löhning
143dedf2f5 LanguageClient: Fix state string
After a shutdown, the client is shut down.

Change-Id: I092af02bfb72fda611229af42a838071890bfce9
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-03-29 13:29:54 +00:00
David Schulz
eb7ccfd889 LanguageClient: add action to open call hierarchy
Fixes: QTCREATORBUG-28839
Fixes: QTCREATORBUG-28842
Change-Id: Icb70412282c0c2c36241559d942a58ffddab5664
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-03-22 14:40:38 +00:00
David Schulz
6dcc1771e3 LanguageClient: fix show message box
Add a default close button and connect all language server defined
buttons to accepted, so the message box gets closed when the user
presses a button.

Change-Id: I846eadf5953e75441bdc7910c2587a2fa098a388
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-03-21 06:20:44 +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
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
David Schulz
9938fffe06 LanguageClient: close and reopen renamed documents
That is the way accoarding to https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_didRename

Change-Id: Ibed1873ac85eb2e9074481537a34f959a55a6f71
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-01-23 14:01:20 +00:00
hjk
77054c2fa3 LanguageClient: Tr::tr
Change-Id: Idbd7c5cdadba4f269b2033df91db0e05bb5281d5
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-20 07:56:04 +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
David Schulz
887db6b419 LSP: implement call hierarchy
Fixes: QTCREATORBUG-11660
Change-Id: I006872ba598a807f1f9f16d134fe9ce4fe5dd09d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-01-11 09:49:01 +00:00
Marcus Tillmanns
bf9e2110e6 LSP: Use localSource
This change allows the LSP to find a local version of a source
file even if the server is running on a remote device.

Change-Id: I274cb327ad958ac3c4486859da666702758b7d42
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-10 07:03: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
Eike Ziller
3f4c3a3db4 Merge remote-tracking branch 'origin/9.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/texteditor/texteditor.cpp

Change-Id: I9c8f1331be3f5442f1fd28aeb0a9bc07128629d1
2022-12-20 11:05:01 +01:00
David Schulz
c8e1201236 LanguageClient: Do not send out invalid errors
An error is expected to contain an error message so add one that misses
one. Additionally assert when trying to set an error to a response that
is invalid (does not contain message or code.)

Fixes: QTCREATORBUG-28598
Fixes: QTCREATORBUG-27856
Change-Id: I0631433d847610531758d297a93a5c7cdfdc6c1d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-12-16 07:05:55 +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
David Schulz
3754ce184d LanguageClient: remove refactoring markers when deactivating document
Fixes: QTCREATORBUG-28182
Change-Id: Iab52862ecc205c65d8fbdac34b5f9bc78766e33b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-19 12:01:59 +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
David Schulz
01b07c0563 LanguageClient: deactivate documents on client shutdown
Change-Id: I0a3aa89b1390f3cb7d5816bb85d9fd538fb3f90b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-10-14 09:08:11 +00:00
Marc Mutz
8eb4d52342 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.

Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
2022-10-07 13:47:53 +00:00
David Schulz
54feec93e3 LanguageClient: correctly initialize editors of opened documents
Change-Id: I2dee2093c0bdb97a204e89bf0db526ae405b8e78
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-09-23 11:39:10 +00:00
David Schulz
b88ba1b7a6 TextEditor: add optional action mask for find usage
Change-Id: If8187b226d176c292d0d90aed870f78d9d3d2730
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-09-23 11:39:07 +00:00
David Schulz
1c05237820 LanguageClient: prevent accessing freed data on shutdown
Change-Id: I0d6e7abd653acb2ab7409a9cd5e58a2df3b1f259
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-09-22 10:07:53 +00:00
David Schulz
aeb5f90d71 LanguageClient: postpone outline update until documents are opened
Skip the outline update in the initialize callback since no documents
are opened at that point in time and
LanguageClientOutlineWidgetFactory::supportsEditor will always return
false. The update will be triggered in
Client::activateDocument instead.

Change-Id: Ib26115c2344f7a424c31ce09b751a1d711a93aae
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-09-08 04:56:32 +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
Aaron Barany
8276bd265b LanguageClient: Adjust restart limits
Changed restart timer to 2 minutes and max restarts to 5 for restarting
language client after it exits unexpectedly. This avoids disabling the
language client with clangd 14 in situations where it's likely to crash
during normal editing.

Change-Id: I333bb9d67ed1dbba2b52a1cd916f5d1cf3c0b60b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-02 10:09:48 +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
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
David Schulz
60f5275edf Client: rerequest document highlight if server is unreachable
Makes sure the highlight is properly updated and prevents assert in
Client::sendMessage.

Change-Id: Ie7ad54c34272867e17f6e20654f27e2fd8711fdc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-08-24 07:53:21 +00:00
Marco Bubke
84c1d6572b Utils: Remove variant.h
Since we are now requiring macOS 10.14 we can remove our local copy of
std::variant and use for macOS std::variant too.

Change-Id: I589d03b35fc56878b7392ffa7047a439e588fe43
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-08-23 09:51:43 +00:00
David Schulz
8031460734 LanguageClient: avoid creating a QTextDocument for every contents change
clone the document when it is opened and adjust it after each contents
change

Change-Id: I4fd511a3b142b1875f1da7d241ab5cddf49322e8
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-08-22 04:38:08 +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
dc2cd9db94 LanguageClient: correctly disconnect documents changed signal on reset
connect calls to a lambda can not be disconnected with the
sender->disconnect(receiver);
syntax, so save the connection in a QMetaObject::Connection and use this
to disconnect the signal.

Fixes: QTCREATORBUG-27596
Change-Id: I69f5d990aab4e85d768e2101f0157a7dee3c1fa1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-08-18 11:58:57 +00:00
Christian Kandeler
bd00cc8bf8 LanguageClient: Introduce timeout for restart counter
While it makes sense to stop trying to restart a continuously crashing
server, the restart counter should be reset regularly, as it's not
critical if the server restarts "once in a while" during a longer
programming session.

Change-Id: Ia2efca28ae4a4dba72da947d9eb776e3909d0cb3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-11 14:12:35 +00:00