Skip to content

Commit

Permalink
Split specification in smaller parts
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaeumer committed Mar 7, 2022
1 parent 172d92d commit ed80401
Show file tree
Hide file tree
Showing 64 changed files with 9,342 additions and 9,336 deletions.
2 changes: 1 addition & 1 deletion _data/specifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- title: 3.16 (Current)
url: /specifications/specification-current
- title: 3.17 (Upcoming)
url: /specifications/specification-3-17
url: /specifications/lsp/3.17/specification
- title: 3.15 (Previous)
url: /specifications/specification-3-15
- title: LSIF
Expand Down
73 changes: 73 additions & 0 deletions _specifications/lsp/3.17/client/registerCapability.md
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.
59 changes: 59 additions & 0 deletions _specifications/lsp/3.17/client/unregisterCapability.md
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.
8 changes: 8 additions & 0 deletions _specifications/lsp/3.17/general/exit.md
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
Loading

0 comments on commit ed80401

Please sign in to comment.