-
Notifications
You must be signed in to change notification settings - Fork 764
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split specification in smaller parts
- Loading branch information
Showing
64 changed files
with
9,342 additions
and
9,336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#### <a href="#client_registerCapability" name="client_registerCapability" class="anchor">Register Capability (:arrow_right_hook:)</a> | ||
|
||
The `client/registerCapability` request is sent from the server to the client to register for a new capability on the client side. Not all clients need to support dynamic capability registration. A client opts in via the `dynamicRegistration` property on the specific client capabilities. A client can even provide dynamic registration for capability A but not for capability B (see `TextDocumentClientCapabilities` as an example). | ||
|
||
Server must not register the same capability both statically through the initialize result and dynamically for the same document selector. If a server wants to support both static and dynamic registration it needs to check the client capability in the initialize request and only register the capability statically if the client doesn't support dynamic registration for that capability. | ||
|
||
_Request_: | ||
* method: 'client/registerCapability' | ||
* params: `RegistrationParams` | ||
|
||
Where `RegistrationParams` are defined as follows: | ||
|
||
<div class="anchorHolder"><a href="#registration" name="registration" class="linkableAnchor"></a></div> | ||
|
||
```typescript | ||
/** | ||
* General parameters to register for a capability. | ||
*/ | ||
export interface Registration { | ||
/** | ||
* The id used to register the request. The id can be used to deregister | ||
* the request again. | ||
*/ | ||
id: string; | ||
|
||
/** | ||
* The method / capability to register for. | ||
*/ | ||
method: string; | ||
|
||
/** | ||
* Options necessary for the registration. | ||
*/ | ||
registerOptions?: LSPAny; | ||
} | ||
``` | ||
|
||
<div class="anchorHolder"><a href="#registrationParams" name="registrationParams" class="linkableAnchor"></a></div> | ||
|
||
```typescript | ||
export interface RegistrationParams { | ||
registrations: Registration[]; | ||
} | ||
``` | ||
|
||
Since most of the registration options require to specify a document selector there is a base interface that can be used. See `TextDocumentRegistrationOptions`. | ||
|
||
An example JSON RPC message to register dynamically for the `textDocument/willSaveWaitUntil` feature on the client side is as follows (only details shown): | ||
|
||
```json | ||
{ | ||
"method": "client/registerCapability", | ||
"params": { | ||
"registrations": [ | ||
{ | ||
"id": "79eee87c-c409-4664-8102-e03263673f6f", | ||
"method": "textDocument/willSaveWaitUntil", | ||
"registerOptions": { | ||
"documentSelector": [ | ||
{ "language": "javascript" } | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
This message is sent from the server to the client and after the client has successfully executed the request further `textDocument/willSaveWaitUntil` requests for JavaScript text documents are sent from the client to the server. | ||
|
||
_Response_: | ||
* result: void. | ||
* error: code and message set in case an exception happens during the request. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#### <a href="#client_unregisterCapability" name="client_unregisterCapability" class="anchor">Unregister Capability (:arrow_right_hook:)</a> | ||
|
||
The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability. | ||
|
||
_Request_: | ||
* method: 'client/unregisterCapability' | ||
* params: `UnregistrationParams` | ||
|
||
Where `UnregistrationParams` are defined as follows: | ||
|
||
<div class="anchorHolder"><a href="#unregistration" name="unregistration" class="linkableAnchor"></a></div> | ||
|
||
```typescript | ||
/** | ||
* General parameters to unregister a capability. | ||
*/ | ||
export interface Unregistration { | ||
/** | ||
* The id used to unregister the request or notification. Usually an id | ||
* provided during the register request. | ||
*/ | ||
id: string; | ||
|
||
/** | ||
* The method / capability to unregister for. | ||
*/ | ||
method: string; | ||
} | ||
``` | ||
|
||
<div class="anchorHolder"><a href="#unregistrationParams" name="unregistrationParams" class="linkableAnchor"></a></div> | ||
|
||
```typescript | ||
export interface UnregistrationParams { | ||
// This should correctly be named `unregistrations`. However changing this | ||
// is a breaking change and needs to wait until we deliver a 4.x version | ||
// of the specification. | ||
unregisterations: Unregistration[]; | ||
} | ||
``` | ||
|
||
An example JSON RPC message to unregister the above registered `textDocument/willSaveWaitUntil` feature looks like this: | ||
|
||
```json | ||
{ | ||
"method": "client/unregisterCapability", | ||
"params": { | ||
"unregisterations": [ | ||
{ | ||
"id": "79eee87c-c409-4664-8102-e03263673f6f", | ||
"method": "textDocument/willSaveWaitUntil" | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
_Response_: | ||
* result: void. | ||
* error: code and message set in case an exception happens during the request. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#### <a href="#exit" name="exit" class="anchor">Exit Notification (:arrow_right:)</a> | ||
|
||
A notification to ask the server to exit its process. | ||
The server should exit with `success` code 0 if the shutdown request has been received before; otherwise with `error` code 1. | ||
|
||
_Notification_: | ||
* method: 'exit' | ||
* params: void |
Oops, something went wrong.