You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-4
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ SwiftLSP offers a quite dynamic Swift representation of the [LSP (Language Serve
8
8
9
9
Since the LSP standard defines a complex amorphous multitude of valid JSON objects, it doesn't exactly lend itself to being represented as a strict type system that would mirror the standard down to every permutation and property. So SwiftLSP is strictly typed at the higher level of LSP messages but falls back onto a more dynamic and flexible JSON representation for the details. The strict typing can easily be expanded on client demand.
10
10
11
-
## Code Examples
11
+
## How?
12
12
13
13
Some of these examples build upon preceding ones, so it's best to read them from the beginning.
14
14
@@ -33,7 +33,7 @@ let myRequestMessageDecoded = try LSP.Message(myRequestMessageEncoded)
33
33
34
34
### Wrap Messages in Packets
35
35
36
-
To send LSP messages via data channels, the standard defines how to [wrap each message](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#baseProtocol) in what we call an `LSP.Packet`, which holds the `Data` of its `header`- an`content` part.
36
+
To send LSP messages via data channels, the standard defines how to [wrap each message](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#baseProtocol) in what we call an `LSP.Packet`, which holds the `Data` of its `header`- and`content` part.
37
37
38
38
```swift
39
39
let myRequestMessagePacket =try LSP.Packet(myRequestMessage)
@@ -48,7 +48,7 @@ let packetTotalData = myRequestMessagePacket.data // Data
48
48
let myRequestMessageUnpacked =try myRequestMessagePacket.message() // LSP.Message
49
49
```
50
50
51
-
### Extract LSP Packets From Data
51
+
### Extract Packets From Data
52
52
53
53
A client talking to an LSP server might need to extract `LSP.Packet`s from the server's output `Data` stream.
54
54
@@ -81,9 +81,10 @@ for byte in dataStartingWithPacket {
81
81
82
82
Beyond what the examples above have touched, SwiftLSP also helps with:
83
83
84
+
* Creating messages for specific use cases (initialize server, request symbols, request references ...)
84
85
* Launching an LSP server executable
85
86
* Matching response messages to request messages
86
-
* Making requests to an LSP Server through `async`**functions**
87
+
* Making requests to an LSP Server through `async` functions
0 commit comments