Commit Graph

64 Commits

Author SHA1 Message Date
David Schulz
37d0525953 LanguageClient: remove friend relationship between manager and plugin
Change-Id: I594d62615f365db34174c4bd1e6c8a9f6aeb545a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-04-04 08:18:41 +00:00
David Schulz
543ab86ebc LanguageClient: connect each editor widget to the LanguageClientManager
... not just the first returned by BaseTextEditor::textEditorForDocument

Change-Id: I262cd68e6dea59aa23be718fb85d2ae68c40ef39
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-03-12 12:47:52 +00:00
David Schulz
dd92ef15c1 LanguageClient: Use document instead of editor opened/closed
Makes sure that the same document is not twice reported as opened to the
language server.

Change-Id: I348b0f4d8f9162e6ba73a4e3292abce146935eca
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-03-12 12:47:43 +00:00
David Schulz
fa1862c782 LSP: move text marks from the manager to the individual clients
Diagnostics are “owned” by the server so it is the server’s
responsibility to clear them if necessary. So do not delete the
corresponding text mark after a file was closed, because the server does
not have to resend the diagnostics when the file is reopened. Only
delete text marks when they are replaced or when the client is deleted
or reset.

Change-Id: Ief821c7ec401f4c52ee30d99f8dec47dcd6f1c98
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-02-04 11:22:59 +00:00
David Schulz
93ea656821 LSP: rename BaseClient -> Client
Since BaseClient isn't part of an inheritance hirarchie any more the
Base doesn't make sense now.

Change-Id: I69200b19a22e5a04079e5289a02234af4f56a1bd
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-02-04 09:43:22 +00:00
David Schulz
aa2ad04e04 LSP: add Command and CodeAction support to the language client
Change-Id: I9e86c17b87c6b6aef36bd0ca293d9db40c554aad
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-01-31 14:20:44 +00:00
David Schulz
d14490d302 LSP: Collect usages of the symbol under cursor
Fixes: QTCREATORBUG-21577
Change-Id: I2bc6a0ac094eb74f802f5fe77a6eab2c82cbbbbf
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-01-17 06:39:40 +00:00
David Schulz
0a8a4bad7e LSP: add outline support
Fixes: QTCREATORBUG-21573
Change-Id: If579715c84210eb80d258ec944e00f1fac1badbe
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-01-10 07:26:08 +00:00
Alessandro Portale
b2cea9474c LanguageClient: Modernize
modernize-*

Change-Id: I966de09934b9ba3b0497d1df5744c8c3f826240f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-11-14 08:52:21 +00:00
David Schulz
1b2ad0e989 LSP: let the settings generate the client
In preperation for settings other than the stdio client.

Change-Id: I11635119db9165163947d822e911ee26ce8548f1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-09-20 13:04:54 +00:00
David Schulz
5ef4530b8f LSP: use asynchronous shutdown for running servers
Change-Id: I3b1853177d07c98e051de0bc9f494389fbf4c104
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-09-20 12:37:48 +00:00
David Schulz
ba5f93003e LSP: correctly shutdown client that is currently being restarted
Change-Id: I9fb0ccd9aa181515efc9368b0b369dfc39dffcd1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-09-19 10:44:58 +00:00
David Schulz
87381bbf90 LSP: use QtcProcess::splitArgs for language server arguments
Also store the executable and arguments in the stdio client to get a
more accurate comparison of clients.

Change-Id: I84fdd4ea5f32b17198d3f08e7f5d494f7fbe67dc
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-09-11 10:04:52 +00:00
David Schulz
d61d29cf16 Introduce a basic client for the language server protocol
The language server protocol is used to transport language specific
information needed to efficiently edit source files. For example
completion, go to operations and symbol information. These information
are transferred via JSON-RPC. The complete definition can be found under
https://microsoft.github.io/language-server-protocol/specification.

This language server protocol support consists of two major parts, the
C++ representation of the language server protocol, and the client part
for the communication with an external language server.

The TypeScript definitions of the protocol interfaces are transferred to
C++ classes. Those classes have getter and setter for every interface
value. Optional values from the protocol are represented by
Utils::optional<ValueType>. The JSON objects that are used to transfer
the data between client and server are hidden by a specialized
JsonObject class derived from QJsonObject. Additionally this JsonObject
provides a validity check that is capable of creating a detailed error
message for malformed, or at least unexpected JSON representation of the
protocol.

The client is the interface between Qt Creator and language server
functionality, like completion, diagnostics, document and workspace
synchronization. The base client converts the data that is sent from/to
the server between the raw byte array and the corresponding C++ objects.
The transportat layer is defined in a specialized base client (this
initial change will only support stdio language server). The running
clients are handled inside the language client manager, which is also
used to connect global and exclusive Qt Creator functionality to the
clients.

Task-number: QTCREATORBUG-20284
Change-Id: I8e123e20c3f14ff7055c505319696d5096fe1704
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-09-03 08:00:46 +00:00