Skip to content

Commit

Permalink
Details on responding to events
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Jan 18, 2024
1 parent 3643e04 commit f5a53e0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,28 @@ Right now, there are still some bits useful for client support in this library:

The intention is to migrate all of these out into LanguageClient, leaving this library purely focused on protocol-level support.

## Usage

### Responding to Events

You can respond to server events using `eventSequence`. Be careful here as some servers require responses to certain requests. It is also potentially possible that not all request types have been mapped in the `ServerRequest` type. The spec is big! If you find a problem, please open an issue!

```swift
Task {
for await event in server.eventSequence {
print("receieved event:", event)

switch event {
case let .request(id: id, request: request):
request.relyWithError(MyError.unsupported)
default:
print("dropping notification/error")
}
}
}
```


## Supported Features

The LSP [specification](https://microsoft.github.io/language-server-protocol/specification) is large, and this library currently does not implement it all. The intention is to support the 3.x specification, but be as backwards-compatible as possible with pre-3.0 servers.
Expand Down

0 comments on commit f5a53e0

Please sign in to comment.