Commit Graph

98 Commits

Author SHA1 Message Date
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
Eike Ziller
5c7793b07b LanguageClient: Do not pop up general messages pane
General messages pane should only be opened on direct user interaction.

Task-number: QTCREATORBUG-24430
Change-Id: I526659110fc67c627cb60fe56e1f709f064667c2
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-01-04 07:30:07 +00:00
Jarek Kobus
cf010911f7 Don't allocate unneeded temporary containers
Fix clazy warnings: allocating an unneeded temporary container
[clazy-container-anti-pattern]

Change-Id: I4b4c2c634eea650bbdf3c12d982a17f899fc94ec
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2020-12-14 12:35:47 +00:00
David Schulz
2b36770d07 LSP: add rename functionality
Fixes: QTCREATORBUG-21578
Change-Id: Iec54ebed6358453af4ef16a2a4e6aef0418faebe
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-17 07:51:52 +00:00
hjk
cf91b2c033 LSP: Do not accumulate connections during signal emission
Amends cdeac76df3.

During the execution of updateProject() triggered by a fileListChanged()
emission new connections to the fileListChanged() were added, effectively
making the emit never return and gobbling up all available memory.

Change-Id: I18a1ab9b32c2e797e990449385a5353782211560
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-25 07:54:42 +00:00
David Schulz
4121eccf1e LSP: add symbol support class
Declutter the client and client manager by moving find usage and follow
symbol into this helper. This functionality was "temporary" put into the
client manager, but is more an implementation detail that shouldn't be
handled in that central place. Rename symbol will also go into this
helper class.

Task-number: QTCREATORBUG-21578
Change-Id: I56680f6ccbb8d244066561167178af7b341b8822
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-19 10:10:12 +00:00
David Schulz
8f5109b6ee LSP: Robustify open documents
Use Client::openDocument if you just want to open a document and
activate it if it is not already used in another client.

Use LanguageClientManager::openDocumentWithClient if you want to make
sure a document is opened _and_ activated for a specific client.

Change-Id: I6b790f15e17335ce2dc8981a04d2cd571b22b66b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-14 09:51:26 +00:00
David Schulz
cdeac76df3 LSP: react on file list changed signal from project
Fixes opening projects that lazy load their file lists. For example
CMake projects open without a file list. This list will be generated
after a successful configuration of the project.

When a session is loaded that contains an open document from a project
the document and project open signal is triggered when there is still no
connection between these two. So recheck the project for documents after
the file list got updated.

Also add documents that are already opened before they are assigned to a
project.

Change-Id: I6f2bde0edf88a505116b05efe5564318f2cfb892
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-13 10:58:25 +00:00
Alexis Murzeau
15419cb145 LSP: Fix completion assist that could be the wrong provider
When a document is opened that uses a language server, it would not gain
the completion assitance from the language server in some cases.
Instead, the default completion assist provider is used, which in case of
the TextEditor, will only provide basic autocompletion.

The reason is that Client::activateDocument is not called if the document
is not in LanguageClientManager::m_clientForDocument when
Client::openDocument is called. The check is at the end of that function.
When the issue happens, openDocument is called indirectly from
LanguageClientManager::documentOpened.

The fix is to change the order of instructions in
LanguageClientManager::documentOpened so m_clientForDocument is updated
before calling openDocumentWithClient.

This way, the language server's completion assist is really used as it
should.

Change-Id: I0d2b3b8573e97c0c0c4bd517775668d41a4a797b
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-04-29 19:36:20 +00:00
David Schulz
821f073f15 LanguageClient: Add logging window
Change-Id: Ib86b70381b69df55d62a97abdf52b747f7f1c75e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-03-02 13:38:46 +00:00
Eike Ziller
fa59e02f89 Merge remote-tracking branch 'origin/4.11' into 4.12
Change-Id: I8cc80483cdb10309bf73aba5cfab52c1d90e1bbc
2020-02-26 08:14:47 +01:00
David Schulz
8625bbfe5a LanguageClient: Fix client restart after crash
Do not clear open documents but disconnect and deactivate them,
so they can be correctly reopened once the server is restarted.

Change-Id: I0f61a5461c020865e61d9808e8c645ea842f64ad
Fixes: QTCREATORBUG-23648
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-02-25 13:17:13 +00:00
David Schulz
83eab470c1 LanguageClient: Only send position changed signals to reachable clients
Change-Id: I0d387ea10aeba8f5f1be3d0ddb6a6ccb82e04e64
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-02-25 13:16:58 +00:00
David Schulz
73161356d5 LSP: take account of resolveTarget when checking for links
Return a link to the word under cursor when the target should not
get resolved. This results in a highlight of the text the mouse cursor
is positioned on when pressing ctrl to follow a link.

Change-Id: Iaf1ba289644ed3e3fc062b418dd2fa3bfa8da6ad
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-11-28 14:05:05 +00:00
David Schulz
02b7a529dd LanguageClient: request link from active server for the document
Instead of sending the link request to all reachable server send it only
to the server that is currently used to handle this document.

Change-Id: I27a8d0e4573f734baa2931a0af771e60665a4532
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-11-18 14:40:28 +00:00
David Schulz
6399188090 LanguageClient: prevent accessing deleted document
By always removing them from the list of opened documents also for
uninitialized clients. Fixes crash when closing creator before the
initialize response of a language server was handled.

Change-Id: I81fb15d8d9d7bf47300a6eac373ef9db04387bd4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-10-29 08:17:41 +00:00
David Schulz
28c3f0c31e Python: Add info bar entry to enable pyls
Show an editor info bar entry displaying that the language server for
the current python is disabled and a button to quickly enable the pyls.

Change-Id: I3adb2e7cbfb1a32e35413b0b06dfbe66a0b214af
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-10-18 05:23:29 +00:00
David Schulz
9afc5305d6 TextEditor: more FileName -> FilePath renaming
Change-Id: Ia61868806db47561e7bf7ae9b3cfb1e62a085a7a
Reviewed-by: hjk <hjk@qt.io>
2019-10-01 07:54:11 +00:00
David Schulz
57749e91e8 LanguageClient: allow adding settings via the manager
This adds the possibility to configure language servers
from other plugins.

Change-Id: I33c7d637ddd73dcfc0d02c366b8b9749ac1c2b98
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-23 09:51:41 +00:00
David Schulz
20e6e84b1a LanguageClient: Add already open documents to starting client
After settings are applied in the manager make sure to assign all
open documents to the newly created clients if the document filter
accepts them.

Change-Id: I30e06e37bc4fde0bc7bab34a2de564a7df043edf
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-23 08:51:46 +00:00
David Schulz
468f604900 LanguageClient: have one active client per open document
open a document in all clients supporting the document, but have just
one client that provide functionality like highlights, completions, and
find usages.

Change-Id: I6bd72eb022005ed643fefd1da139d482f4dd5279
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-19 08:53:47 +00:00
David Schulz
f0ad5813b9 LanguageClient: more FileName to FilePath renaming
Change-Id: I803211d462b442b6881a02e870d2cd816675e0d9
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-17 08:15:40 +00:00
David Schulz
d3c94edd93 LanguageClient: only send contents of TextDocuments to the server
Change-Id: Ifdcd6ba161336814744c51f15e35a756960cb199
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-12 10:53:57 +00:00
Eike Ziller
8df0653bf8 Merge remote-tracking branch 'origin/4.10'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/projectexplorer/gcctoolchain.cpp
	src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp

Change-Id: Iffdf48e782a734107ea170ebb3812e997cea0e7b
2019-09-12 09:08:04 +02:00
Orgad Shaneh
2aca0c1b28 Fix MSVC warnings
* Missing `this` captures
* Implicit size_t -> int conversion
* Unused argument
* Suppress warnings in clang headers

Change-Id: I7083ce6ab22ee22ecc1258539e77c790acc78df1
Reviewed-by: hjk <hjk@qt.io>
2019-09-11 15:20:34 +00:00