Commit Graph

20 Commits

Author SHA1 Message Date
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
Eike Ziller
e5c2ee922a Merge remote-tracking branch 'origin/4.8'
Conflicts:
	src/plugins/cpptools/compileroptionsbuilder.cpp

Change-Id: I743ea39480cc5c7b6febcd2e93713d15a3ae6d9c
2018-12-07 08:53:11 +01:00
David Schulz
257df2e4b8 LSP: fix crash after last server restart attempt
The client got indirectly deleted from the manager while still in the
parsing output function during the last restart attempt. Fixing it by
freeing the client via deleteLater.

Change-Id: I2539a8b96b5568dc2ae15a6bfe4f2ab02c280f67
Fixes: QTCREATORBUG-21635
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-12-05 07:34:09 +00:00
David Schulz
e52ea7771f LSP: simplify request response type
Instead of always defining the templates of the response type by hand
add a using construct in the Request where all the template types are
known.

Change-Id: I0dc00bd9aef9c37c9454e35aca200a30fcf2ebda
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-11-20 07:57:22 +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
e18cbad285 LSP: Inform user about an unexpected server finish without restart attempt
A message is already printed after an unexpected finish with restart attempt.
Without this last message it looks like Qt Creator still tries to restart
the server.

Change-Id: I47dd3e768d061a7d039ee3f125368c6e166ebf81
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-11-06 07:58:13 +00:00
Christian Stenger
88a6276551 LSP: Avoid crash in shutdown
Having a corrupt language server might end up in a double
delete when closing the client.

Change-Id: I23e02d666d6c070a9f4b33605782fe875c5cabe6
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-11-05 09:33:48 +00:00
David Schulz
52cfa8b6f8 LSP: forcefully close language server after 3 seconds on shutdown
When closing Qt Creator a message is send to the server requesting to
shutdown. Waiting an undefined amount of time for the response could
result in a never closing Qt Creator.

Change-Id: If09a32d34c546ae4702669d65e4921873e5658ea
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-11-05 08:00:44 +00:00
David Schulz
c37bedfb02 LSP: split out settings specific for std io clients
Change-Id: I25eebfc15a9d0d5665e57137f016e54a069ca849
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-10-15 11:51:10 +00:00
Christian Stenger
c67b2e84cc LanguageClient: Perform safe shutdown of clients
This avoids running into a soft assert and is basically the
common pattern used when shutting down the client.

Change-Id: I9a2eea8d2ffe51f81d6bb78353606ef492628897
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-10-15 08:23:10 +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
fb058b850b LSP: limit the number of server restart attempts
Change-Id: I65f845d44bcfb318f36d876c0806c7b48e8e09df
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-09-20 12:37: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
f6da85cc4b LSP: support 'window/showMessageRequest' and 'window/showMessage'
All showMessage notification are send to the GeneralMessages Pane and
the showMessageRequest will show a message box

Change-Id: Ida3f2a43669ec4c08694ed74e086a281d3d66f9d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-09-14 09:21:30 +00:00
David Schulz
d3c31ff945 LSP: move templated register function to JsonRpcMessageHandler
Change-Id: Iaabc994c610842b39e61b249d9ca34b029895aae
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-09-14 09:21:24 +00:00
David Schulz
ccf2d848f4 LSP: generalize adding message provider
Change-Id: Ie15e835871a416523d58aba5362a34806cc8b70f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-09-13 10:18:51 +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
4d256654e0 LSP: do not connect the clients finished signal multiple times to the manager
Change-Id: I3f4d176837eda7ef2cf672f9d9cbdd5ba7d54bbe
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-09-05 11:55:01 +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