Commit Graph

122 Commits

Author SHA1 Message Date
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
David Schulz
426fde79d6 LanguageClient: support semanticTokens/refresh
Fixes: QTCREATORBUG-26499
Change-Id: Icd5879609bb856797fa223394357a1f15554d2cf
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-11-03 07:46:50 +00:00
The Qt Project
ea3f38e217 Merge "Merge remote-tracking branch 'origin/5.0'" 2021-08-30 14:31:22 +00:00
Christian Stenger
752b967952 LanguageClient: Fix possible crash
If a restart for a client has been staged for restart the
shutdown of QC may coincide with the start of the client which
leads to a crash on exit. Correctly track clients that never
successfully started to clean them up on manager destruction.

Change-Id: I639a76318d1665653fbcd37841fcaf407f3d3a83
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-30 12:23:05 +00:00
Eike Ziller
987ad3fe9c Merge remote-tracking branch 'origin/5.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/android/androidconfigurations.cpp

Change-Id: Icd2b0fda2b2653656285bbbe457c30c9cd414d3f
2021-08-30 12:15:37 +02:00
Eike Ziller
940a203d93 LSP: Set client working directory to project directory
If the server settings specify that a server is to be started "per
project".

This fixes e.g. running the haskell-language-server

Fixes: QTCREATORBUG-26115
Change-Id: If10af71d60786826a9218b4b98818df8d9710adf
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-30 08:16:38 +00:00
Christian Kandeler
e0e8fda580 ClangCodeModel: Use clangd for completion and function hint
Change-Id: I80160f3a40da18ac178682afe6caba5e5af6e3eb
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-23 09:06:31 +00:00
David Schulz
341234f3cf LanguageClient: always connect client to manager
The client will be either freshly created or if it was restarted
disconnected in LanguageClientManager::clientFinished

Change-Id: I647d0aaa918419c328013b2dc978d345f7e09c32
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-08-16 06:53:15 +00:00
David Schulz
5c5e9bd339 LanguageClient: reset assigned documents on shutdown request
Allows to reassign the documents to another server before the old server
is completely shutdown.

Change-Id: I20538c317a7664523f55073736eb22d96def8df8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-07-14 13:17:20 +00:00
Christian Kandeler
ecafdb7543 ClangCodeModel: Add experimental clangd support
If the user has enabled clangd (default is off), we start up one instance
per project when it is opened/changed (including build config switches),
and trigger background indexing.
So far, the index is used to provide results for locators and "Find
Usages".
Per-document functionality such as semantic highlighting and completion
is still provided by libclang.

Change-Id: I12532fca1b9c6278baab560e7238cba6189cde9f
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-04-22 07:32:58 +00:00
David Schulz
f1bb3b6811 LSP: add semantic tokens
Change-Id: Ia6865ec6991ec62ae9f0dc2dfa692f1f27318ed1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-21 11:33:56 +00:00
Eike Ziller
5c713d624c Merge remote-tracking branch 'origin/4.15'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: I309fe2a4ea7afac85481fc6466a9a6e58e340019
2021-03-18 09:41:37 +01:00
David Schulz
c218f77f7e LanguageClient: compress documentHighlight requests
Change-Id: I98707a61a228c66966c72f6b4da2470b6f53820e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-16 11:07:09 +00:00
David Schulz
a7fc1631a7 LanguageServerProtocol: add progress support
Change-Id: I8d3ccf0626ccde39516bbd024ed6e2da0380e4de
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-16 04:54:44 +00:00
David Schulz
01caf29221 LanguageClient: assign document to correct client
If a server is setup to start per project we want to open files of a
project in the matching server by default.

Change-Id: Ie266fd858420acd75b7a1fd45be7bee2b06460aa
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-02-23 08:52:56 +00:00
David Schulz
032407a6fe LanguageClient: select current client when opening inspector
Change-Id: I4bfd74e7e9a8c0f4b60ed034faac86c2fb9bb018
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-02-18 09:39:01 +00:00
David Schulz
f9502a3ba6 LanguageClient: move capabilities widget to inspector
The capabilities are not changeable for the user, but only there to
check whether a server is capable of a specific task. This will also
allow us to have more specialized settings widgets for specific servers
like for the java language server without the need to add the
capabilities to each of those special widgets.

Also add the dynamic capabilities to the widget so users have a complete
overview of the capabilities.

Change-Id: I9f2ed6ed11b458f0d4c67be3df632fd810023286
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-02-18 09:38:56 +00:00
David Schulz
5cbf323014 LanguageClient: track clients again
Amends 166fce5036.

Change-Id: If78ca6a15fd5b5f809ef7693b3b31131a0973df3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-02-17 11:30:52 +00:00
David Schulz
166fce5036 LanguageClient: improve Server startup
Starting a client does not need to be done via
LanguageClientManager::startClient anymore but can be done via
Client::start()

Change-Id: I571e96b6ad7d64786a345edf5dbb38208b9a1d12
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-02-16 14:13:20 +00:00
David Schulz
b865fa5571 LanguageClient: Rename logger -> inspector
... to be able to add more features to this dialog.

Change-Id: If8692bee484e25c1ba5e4ea629a77d14ff5d92ab
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-02-15 14:33:15 +00:00
David Schulz
fa260e00ed LanguageClient: cleanup languageclientmanager
- sort includes
 - fix clazy and clang-tidy warnings
 - remove unused function
 - adjust naming ('interface' -> 'client')

Change-Id: I12ada223a7a04796f0e6ac992cedf83aefe2ecc0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-29 13:48:25 +00:00
David Schulz
9759f9e169 LanguageClient: check current instead of page settings
It does not make sense to check the not applied settings of the
settings page when a document gets opened.

Change-Id: I6fda0cf6c524e79e17cc25b54c41527971179f8b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-29 11:16:46 +00:00
David Schulz
71da9d340d LanguageClient: use less magic when changing settings
Change-Id: I8c5f5a85bff7cf0cf0545199358c306f7f9b539e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-29 10:59:32 +00:00
David Schulz
58ff83b85b LanguageClient: Fix restarting server that needs a project
Do not open the server for every open document that belongs to that
server and assign the documents to the correct servers.

Change-Id: I88a743489e7e4b396a112ad772926e90b22626f3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-29 10:59:17 +00:00
Eike Ziller
aae3bf4ef7 Merge remote-tracking branch 'origin/4.14'
Change-Id: I516e87eed1b716ec085095c9dd4f47f04a99de7c
2021-01-25 09:06:36 +01:00
David Schulz
4f1c5bacb9 LanguageClient: fix multiple crashes in languageClient
The temporary containers are needed in some places because the content of the containers change
while iterating over them.
partially reverts: cf010911f7

Change-Id: I4d6df987b9e5382b6b18fa659b1174ca6919a02e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-25 07:42:26 +00:00
David Schulz
eb586385b5 LanguageClient: correctly handle dynamic registered capabilities
Change-Id: Iaeacad68bbff0aded4dd029405fa28a237a65940
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-22 05:34:39 +00:00