Commit Graph

148 Commits

Author SHA1 Message Date
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
6b600798a4 LanguageClient: Remove the old matchesFor() implementation
Rename some workspace filter classes to conform to
the names for cpp filters.

Remove some unneeded intermediate classes now.

Change-Id: I1ec0dbb7ed91944e9dd8b1b0f4878b826191a020
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-15 08:00:30 +00:00
Jarek Kobus
ed120516f6 DocumentLocatorFilter: Get rid of the arg from c'tor
It's always LanguageClientManager::instance().
Pimpl LanguageClientManager's filters, so that they are
constructed after the managerInstance is being assigned.

Change-Id: Ib1f6f0c96d57d0e4cb7332ce322f6c4e9ef9fdb1
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-18 09:03:14 +00:00
David Schulz
1bdc638e65 LanguageClient: remove unused variables
Change-Id: I75281300ae5bc432d4571fd9b423c91d53eda310
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-03-23 06:18:22 +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
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
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
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
ca2979ca52 LanguageClient: Do not untrack documents before restarting a client
shutdownClient removed the association between the document and the
client, but this is one of the information we would like to keep when
restarting a client. Also we never want to delete the client when
calling restart.

Change-Id: I0558c27ba4b9171c7933edaf2e17847d4e6f62b6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-19 10:10:42 +00:00
David Schulz
f920ee217b LanguageClient: remove unused code
Change-Id: Iac6a0f02aa52d9d5d1699200b2dd328c00ea9f30
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-17 07:16:34 +00:00
David Schulz
d62d39642e LanguageClient: Add action to restart client to editor toolbar
Change-Id: Ib2fb0f6d9a5b3baeac937f298670887fa704ddce
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-01-09 14:12:22 +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
223bec26a1 LanguageServer: Add tooltip to file pattern
Change-Id: Ic404636bda45e9ff7ff3639232ebddfbfaf821c6
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-16 12:28:32 +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
8c8f3e30b5 LanguageClient: Fix handling of defective language server
If the language server cannot be started, the client might be already in
an error state before the language server gets initialized.

Change-Id: Ib6c9df13b381e7854806714c07f4830796bb2cd3
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-12-07 10:58:31 +00:00
David Schulz
69fef7480e LanguageClient: prevent nullptr access
Change-Id: Id0dc46d3775d5e765d1e7d2c2eac0d7f807f34ce
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-11-30 13:11:09 +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
David Schulz
fc24f5c26d LanguageClient: use separate variable to save shutdown state
The LanguageClientManager might be already gone.

Change-Id: Ia674a8c76e0c1bb39e1503be9cffc20fd69120bb
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-10-14 05:33:13 +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
fbbf0d9149 LanguageClient: show only one inspector widget at a time
Change-Id: I72630c85e9420ae873a57919e2d5434c83a5626c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-09-27 07:53:11 +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
e7237a9675 LanguageClient: ensure that deleted clients are untracked in manager
Change-Id: I0624ce9e6f8788af7193ebdf87b72497bab0ba39
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-09-22 10:07:59 +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
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
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
David Schulz
6c8605ced2 Python: automatically disable outdated pyls settings
Change-Id: I301c6df3fdd9cf634a1abff20c6f24b9bc5fc23b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-24 11:23:52 +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
David Schulz
7c86d1a195 LanguageClient: pimpl Client and cleanup includes
Change-Id: I653861e29baeaddcbcd21a5e738be6bd85514617
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-23 11:58:09 +00:00
David Schulz
0b6bc0d187 LanguageClient: Move the BaseMessage to JsonRpcMessage conversion
... to the client interface. JsonRpcMessages are the only messages used
so far and no other types of messages are currently used by any of the
supported Language Servers. If a client is going to need special message
parsing it can still implement a specialized client interface and
overwrite parseCurrentMessage. This is the preparation to move receiving
and parsing data passed to and from the language server out of the GUI
thread.

Change-Id: Ibd4cd95daab7efff947273ca9e7d457de0286f47
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-17 04:31:06 +00:00
David Schulz
42fc527fec LSP: Simplify content parsing
JsonRpcMessageHandler::toJsonObject can be expensive for huge
json objects like the clangd ast responses for big c++ files. Avoid
calling this function in Request::responseHandler. We already generate a
JsonRpcMessage in JsonRpcMessageHandler::parseContent to get the id of
the response so pass this around.

While at it also pass around references instead of pointers to simplify
the memory handling of generated messages.

Change-Id: I9a3c7e85428fc064d1ea1197d897739725265192
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-04-14 12:59:49 +00:00
Jarek Kobus
c4e75b7e20 LanguageClientManager: Don't delete the client directly
LanguageClientManager::deleteClient() may be called directly
from Client::finished() handler, from BaseClientInterface::finished()
handler, from StdIOClientInterface::onProcessFinished() handler
or from QtcProcess::finished() handler. Don't delete
directly any of this objects - delete later instead.

Since now we have delayed the deletion of clients, we can't
send directly the shutdownFinished() signal,
as we have not really finished the shutdown yet.
Since all the calls to clients' deleteLater() were
scheduled before emitting shutdownFinished(),
we send the signal using queued connection, which should
guarantee that all clients' destructor were already executed
before calling asynchronousShutdownFinished().

Task-number: QTCREATORBUG-27316
Change-Id: I4f2c8a756ca86c36cc6324af14b99a9fd4513cd3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-04-05 12:41:32 +00:00
David Schulz
d824c276df LanguageClient: constify createClient
Change-Id: I4b9aba1388a31b6d1531cb4a6346a394c5aab150
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-21 08:48:29 +00:00
David Schulz
1a88f26d8b LanguageClient: rename clientForSetting -> clientsForSetting
Change-Id: Idf4055769fba4c2551ac968c0232ddb3916acb6c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-21 08:48:24 +00:00
David Schulz
5924268568 LanguageClient: unify client container
Change-Id: I17b5e7ca4999cd5a9ca8e79577f29854082b6c6b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-21 08:48:17 +00:00
Eike Ziller
f562ebf239 Mimetypes: Make implementation switchable between new and old
- configure with QTC_USE_NEW_MIMEDATABASE to switch to the new one in
  utils/mimetypes2/
- added utils/mimeutils.h header for the Qt Creator specific static
  wrappers, that also includes the "public" headers for MimeType et al
  from the new or old implementation, depending on configuration
- change all utils/mimetypes/ includes to utils/mimeutils.h
- move the implementation for the wrappers to
  utils/mimetypes(2)/mimeutils.cpp
- also move the MimeDatabase declaration in the "old" implementation
  back to utils/mimetypes/mimedatabase.h

Change-Id: Ie8de229c035d6cd9a5e4739dc0fa78d9c17228e3
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>
2022-02-25 07:19:58 +00:00
David Schulz
e59b7612b1 LanguageClient: do not disconnect client from everything before deletion
Otherwise cleanup code connected to QObject::destoyed might not be
executed.

Change-Id: I12bf2b614cf0d216b2f2c0762cc153b4bb845e1f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-02-22 05:20:40 +00:00
David Schulz
5b307634c3 LanguageClient: fix race condition on client shutdown
If a document is closed between removing a closing client from the
tracked clients in the LanguageClientManager and the actual destruction
of that client we might derefernce an already desctructed document in
resetAssistProvider.

Connect the document closed signal in the client instead of the manager
so Client::closeDocument gets called even if it is not tracked in the
manager anymore.

Fixes: QTCREATORBUG-26534
Change-Id: I7187730600eeb1df54355065eb9cb703a605139e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-02-14 09:03:51 +00:00
David Schulz
d59047a4c2 LanguageClient: do not disconnect client from manager
The previously connected signals should be safe to stay connected while
the server restarts. This fixes restarting crashed clients more than once.

Change-Id: I161d41418e10b7e3bd3e17141720f4a5f399841c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-02-10 08:00:26 +00:00
Eike Ziller
3c1a87290e Register some more windows
So they get an entry in the Window menu, and window related shortcuts
are registered correctly.

Change-Id: Ie7e882a009f928f1268fdd312e7fb5362f6a837f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-02-09 09:12:29 +00:00
Eike Ziller
6914deb0da Merge remote-tracking branch 'origin/6.0'
Change-Id: Ie8406c1854738cabcc85ef6ddaee7559d5227bec
2022-01-17 16:52:31 +01:00
Jarek Kobus
e1f45507c5 LanguageClient: fix possible crash on shutdown
Iterate on a copy of managerInstance->m_clients
when calling shutdownClient() or deleteClient(),
since both methods may potentially modify m_clients
list and thus invalidate outer iterators.

Surprisingly, this patch also fixes the leak
of RunControl and RunWorker instances on shutdown.

Task-number: QTCREATORBUG-25709
Fixes: QTCREATORBUG-26847
Change-Id: Ib34d913a6ae0b235631d3d619bddaf4e08b4aec2
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-01-17 10:31:59 +00:00
David Schulz
cc7619804e LanguageClient: announce opened projects just once
... and not on every file list change.

Change-Id: Id74aceb5bb382c01746eca0e014da72e2260b8d8
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-12-01 11:42:00 +00:00
David Schulz
333374e6a9 LanguageClient: move remove project connection to client
Change-Id: I63ff089c7b72a4f72ddf65548dc8df1cc6763ff9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-12-01 05:39:08 +00:00
David Schulz
6aa2c58842 LanguageClient: remove semantic highlighting proposal
The semantichighlighting proposal from
https://github.com/microsoft/vscode-languageserver-node/pull/367
was replaced with semantic tokens in the final protocol version 3.16.

This reverts 307f1d8e6e

Task-number: QTCREATORBUG-26624
Change-Id: I635f0b4763a197edabf9edf8d9041143dcf531e3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-11-29 09:57:45 +00:00
David Schulz
73e30f782d LanguageClient: prevent crash in LanguageClientManager
This also prevents assigning a client to a nullptr document.

Change-Id: Iacefe141a08fd47e69faacd4b0cd156c264ac19b
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-11-19 10:09:37 +00:00
David Schulz
899a4d1f10 LanguageClient: Reopen document after restarting crashed server
Change-Id: I7c8518a631a45ea784ff849b703ae1e9abfba396
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-11-16 16:16:14 +00:00
David Schulz
d511f1798a LanguageClient: add logging to the manager
Change-Id: I953ffd8f281702c3032ce48cd620dcac983b5b25
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-11-10 08:18:50 +00:00