Add doc for cancellation

This commit is contained in:
Dirk Baeumer 2016-04-08 11:32:38 +02:00
parent 8accb68fde
commit 1022b4aa63

View file

@ -2,9 +2,11 @@
This document descibes 2.0 version of the client server protocol. The major changes to the 1.0 version are:
- allignmnet of the protocol with the VSCode exension API. As a result the properties of a request param object conform to parameters in the API. So for example if the VSCode extension API takes a text document has the first parameter the corresponding parameter literal in the JSON RPC protocol now has a property `textDocument`.
- alignment of the protocol with the VSCode exension API. As a result the properties of a request param object conform to parameters in the API. So for example if the VSCode extension API takes a text document has the first parameter the corresponding parameter literal in the JSON RPC protocol now has a property `textDocument`.
- consistent support for language identifiers. This means that the language ID is passed to the server via the open notification. Further references to the text document don't transfer this informaiton anymore.
- support for version numbers on documents. The initial version number is send to the server via the open notification. Document change notification do carry information about VSCode's version number as well.
- Support for request cancellation
- Interface naming: using consinstent names without I prefix.
## Base Protocol
@ -148,6 +150,22 @@ interface NotificationMessage extends Message {
}
```
#### Cancellation Support
The base protocol now offers support for request cancellation. To cancel a request a notification message with the following properties is sent:
_Notification_:
* method: '$/cancelRequest'
* params: `CancelParams` defined as follows:
```typescript
interface CancelParams {
/**
* The request id to cancel.
*/
id: number | string;
}
## Language Server Protocol
The language server protocol defines a set of JSON-RPC request, response and notification messages which are exchanged using the above base protocol. This sections starts descibing basic JSON structures used in the protocol. The document uses TypeScript interfaces to describe these. Bases on the basic JSON structures the actual requests with their responses and the notifications are described.