Commit Graph

503 Commits

Author SHA1 Message Date
Christian Stenger
282c3d0dab LanguageClient: Do not send initializing request twice
Amends dc268e3157.

Change-Id: I6ca81ec336f09c02b26f47b5e00bebbc54882ed6
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-02-16 13:07:59 +00:00
David Schulz
dc268e3157 LanguageClient: log exit notification
Add a private function that logs and sends a basemessage without
checking the current server state and use it for server init,
sendContent and exit.

Change-Id: I6532dfb36ef5bf4d036bb71dbfab4ab29497fc9a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-02-15 13:37:52 +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
Alessandro Portale
26bf18e1fe Core: Turn LocatorFilterEntry ofn ILocatorFilter::accept to const &
In ILocatorFilter::accept and all the overrides.

Change-Id: I27cd6babb66d91aad57e85572a1cdc77aef4fd79
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-02-11 07:35:30 +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
Alessandro Portale
d61069b90f LanguageClient: Prevent extra frame border around outline view
For consistency with other views.

Change-Id: I3d495a3bd037fe917c99bf5e9916651ca48c03fd
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-02-10 07:06:15 +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
c6fdb66b2b Collect Qt Creator debug menu items into common submenu
instead of spreading them over the place.

- rename "Logger..." to "Show Logs..."
- create "Tools > Debug Qt Creator" menu and put "Show Logs", "Inspect
Language Clients" and "Inspect C++ Code Model" there
- add missing ellipsis

That gets rid of the otherwise not useful "Language Client" submenu, and
creates a nicer place for the "Show Logs" item.

Change-Id: I2588b4c93327669579979dfbfce37005ada29dab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-01-26 12:59:21 +00:00
Eike Ziller
2fab827782 Support external editors for locator, projects and file system tree
When setting an external editor as the default editor in the MIME type
settings.

Other operations like File > Open, or when using navigation shortcuts
like Follow Symbol, and stepping with the debugger will still always
open the file within Qt Creator. The Open with... menu can still be used
to explicitly open a file in an external editor afterwards.

One of the use cases is to be able to open some files that would
otherwise unhelpfully be opened in Qt Creator's binary editor in the
systems default editor.

Fixes: QTCREATORBUG-13880
Change-Id: I852f097da8badd10de78b74e7078987447eebe98
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-01-25 12:35:55 +00:00
Eike Ziller
9d8a419d10 Remove qmake build files
Removes qmake as a build system for building Qt Creator itself.
Keep them for some tests that are not completely moved to CMake yet.

Change-Id: I846c6ef65626b6dfae6375fdc85d00677aa8c2fb
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-01-20 12:18:15 +00:00
Jarek Kobus
d6f56254d1 Get rid of QtcProcess::workingDirectory() overload
Adapt all callers' code so that it passes the FilePath
instead of QString. As a consequence introduce
TemporaryDirectory::masterDirectoryFilePath() and use
it where easily possible.

Change-Id: I14564949b3b916921e32a2957c84c03d1da43af2
Reviewed-by: hjk <hjk@qt.io>
2022-01-18 17:18:34 +00:00
David Schulz
8f98ac4120 LanguageClient: remove obsolete "New" in add menu
nobody wants to add an old server...

Change-Id: I06d1d6eba7340181fad876753f888393dab3187f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-01-18 06:03:13 +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
c926db336b LanguageClient: always delay document highlight request
The request for highlights of the symbol under the cursor takes a
considerable amount of time on some servers (at least python). Postpone
those requests a bit so that more important requests can be handled
before.

Change-Id: I35776076a4ee9c0c9b7646e960d3d965506154d3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-01-17 10:23:03 +00:00
David Schulz
9fea2af1e9 LanguageClient: keep semantic tokens after receiving error
A usual error we receive for semantic request is that the request got
canceled. This can be due to external changes. But a server might still
be able to calculate a diff against a previous token set. So just keep
the previously reported tokens and rerequest a new highlight. If the
server is not able to calculate a diff it also might send a full
token set as a result for the delta request according to the protocol.

Fixes: QTCREATORBUG-26624
Change-Id: Ia91e599706519dbbf4cd22050484e4f36cecdab8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-01-14 13:57:08 +00:00
Eike Ziller
85b60d9608 Merge remote-tracking branch 'origin/6.0'
Conflicts:
	src/plugins/coreplugin/editormanager/editormanager.cpp

Change-Id: I80fe565749ad5c06dfe99436f2dc6ab4b66a2537
2021-12-16 10:50:33 +01:00
David Schulz
df46c478dc LanguageClient: simplify diagnostic mark creation
Change-Id: I7d6cb17e6e1f41ab007884bb1c32f92086d3067a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-12-14 13:26:32 +00:00
David Schulz
136026a81b LanguageClient: mark added settings as changed
In order to correctly start a language server after it was added
programmatically it needs to be marked as changed.

Fixes the issue that the python language server did not get started
right after setting it up from the editor info bar.

Change-Id: I9caec91c9d5973912b7379478ab079c87a5231ce
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-12-10 10:28:03 +00:00
Eike Ziller
d422b408e0 Merge remote-tracking branch 'origin/6.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: I32991a77e52831dd2e24cf4a51ec252998c2d743
2021-12-09 12:04:32 +01:00
David Schulz
5d75f1900b LanguageClient: fix crash on completion assist cancel
The Client might be already deleted when the text editor codeassist
calls cancel on the processor.

Change-Id: I6b0b484a086456ed9d0543f530aea0fae32c523a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-12-08 13:54:15 +00:00
Christian Kandeler
67cf7c08d0 LanguageClient: More verbose logging when clearing token data
Change-Id: I3f9883858fa2f23dff00cda9f556f0f4bbff127a
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-12-08 09:46:25 +00:00
hjk
104ea4accc Make some qHash and comparison operators overloads hidden friends
Restricts lookup scope more to necessary bits.

Change-Id: Ia42c95aaa70534843b7f6a90bfc56d2a1202c612
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-12-06 17:10:49 +00:00
Joni Poikelin
41fe7eec65 LanguageClient: fix textDocument/didChange
Fixes: QTCREATORBUG-26651
Change-Id: I640558bc321112f8dd568a4cefc306eb209af7b0
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-12-03 13:07:52 +00:00
Christian Kandeler
825c9ea64f ClangCodeModel: Work around clangd cursor issue
If the cursor is right before the "." in a member access expression,
clangd interprets it as belonging to the member instead of the base
expression, which leads to unexpected behavior.
Work around this by sending a cursor position one to the left of the
real one to clangd in such cases.

Change-Id: I429ee9189760ccb02d231acfcb94ab6cfde3cd8d
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>
2021-12-03 11:17:17 +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
Eike Ziller
d62d0f305b Merge remote-tracking branch 'origin/6.0'
Change-Id: I71b19dd8ecd96a7a2a58622f68283b8635264e48
2021-12-01 09:24:05 +01: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
b38251659b LanguageClient: more log output in the semantic highlighter
Task-number: QTCREATORBUG-26624
Change-Id: Ib276662f1ce2cf355015258c564f6f9c817a3d8a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-11-29 09:44:58 +00:00
David Schulz
f681296484 LanguageClient: select the innermost item in editor outline
When multiple items in the editor outline match the current cursor
select the inner most item.

Fixes: QTCREATORBUG-26509
Change-Id: Ib4ced177059e3a9914ace35e4cdc34959719091a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-11-26 10:51:32 +00:00
hjk
4de74a67ee Merge remote-tracking branch 'origin/6.0'
Change-Id: I773141d47e3f2b773da51f2e26ef53b93bb28f90
2021-11-22 13:18:08 +01:00
Jarek Kobus
b62fbe3ab9 Fix a crash when setting up toolbar editor actions
LanguageClient::updateEditorToolBar() contained the static
hashes that were keeping raw pointers to different
objects. However, the lifetime of these objects wasn't
controlled, so it could happen that we were operating
on dangling pointers.

In fact, like in the bugreport, some text editor widget could have
been deleted (together with his outline action), while later another
one (coincidently with the same address) could have appeared.
The old mapped widget still pointed to the removed action
so we crash.

Instead of keeping a static hashes we attach the custom
child object to the widget and keep there QPointers to all objects
we are interested in.

Fixes: QTCREATORBUG-26588
Change-Id: I335d9848ea85372baf3328772f0a249cee242dcd
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-19 12:29:49 +00:00
The Qt Project
1d785d6687 Merge "Merge remote-tracking branch 'origin/6.0'" 2021-11-19 11:15:43 +00:00
David Schulz
f16a473b3b LanguageClient: make sure to send a response to a request
Restructure the message handling in the client, so if we get a message
with an id always send a response to the server either with the result
or with an error. Also make sure to not send responses to unreachable
server.

Change-Id: Ie74128069c1678af60871896d5dce45c08e71b05
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-11-19 10:32:11 +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
Eike Ziller
eba4115b82 Merge remote-tracking branch 'origin/6.0'
Change-Id: I3bab4e31bc5993c59c7025ebde0846bf6c75810e
2021-11-19 10:44:15 +01:00
Christian Kandeler
78562d4925 LanguageClient: Allow clients to provide extra tabs for inspector
Change-Id: I530eca50393289dbf85fb0088d2a62c2729d28b2
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-17 13:43:29 +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
Christian Kandeler
5769dbe0aa ClangCodeModel: Force clangd re-highlighting on font settings change
Change-Id: Ie449a5329bd49eac116751e66a07602f316e147d
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-15 14:35:02 +00:00
David Schulz
b41280b942 LanguageClient: do not send semantic requests to unrelated server
Change-Id: I97207a8569a5e26a7587fefc07d638b17d36d40b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-11-15 14:28:33 +00:00
David Schulz
d2ff57309b Client: make sure to reset project for client
Change-Id: I23860ee07c4f5793ce3247f46e8d925eae2b2bea
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-11-10 12:50:07 +00:00
David Schulz
a0fba57508 LanguageClient: remove unused variable
Change-Id: I0910a0b75fe727c40c0249437895eb9d3566f7a2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-11-10 10:41:08 +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
Christian Kandeler
4022043792 ClangCodeModel: Ignore redundant semantic tokens
This can now happen due to the newly implemented refresh support.

Change-Id: If64feede84b044140f7ec04e317289d3f493aa53
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-04 09:54:02 +00:00
Jarek Kobus
c13d828c99 Remove unneeded includes of QProcess
Change-Id: I017e020c8b2a53d6f4a2422a0a0856044e768247
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2021-11-03 08:13:18 +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
David Schulz
33cfb7ebfc LanguageClient: add a human readable version of client state
Change-Id: I650e4b4932f32ad86505e9be2fc85eef6bcd6edd
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-11-01 10:22:11 +00:00
David Schulz
3b62755061 LanguageClient: additional log output for the semantic highlighter
Change-Id: Idc4d71bd988b9a23a6718932b4102a00fb94488e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-11-01 07:16:25 +00:00
Christian Kandeler
6f26a1545c ClangCodeModel: Check doc revision when highlighting with clangd
Change-Id: I981d375e3656e89bb66516218e3f4e33ee8bbb9e
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-25 08:45:07 +00:00