SourceKit-LSP over the WebSockets

(Satish) #1

I have been working on Swift Online Playground with Code IntelliSense,

Current Progress,

Done:

  1. Add Monaco Editor In React App
  2. Create a Swift Server App With WebSocket
  3. Integrate Language Server in Monaco
  4. Pass Events to Swift Server App Using WebSockets

Now, @blangmuir what would be the best solution for integration with SourceKit-LSP.

Is it better to add SourceKit-LSP as Library and write own JSONRPCConnection.swift ?

Here you can take look at the app and suggest what approach would be better.

Source Code: https://github.com/satishbabariya/swift-online-playground

you'll get the WebSockets events over here https://github.com/satishbabariya/swift-online-playground/blob/master/Sources/Playground/routes.swift#L75

4 Likes
(Ben Langmuir) #2

Hey, looks really neat! I don't think I fully understand the architecture here - are you hoping to serve multiple connections (users? editors?) from a single sourcekit-lsp process? Could you give more details about how you want this to work?

(Satish) #3

The final architecture will be like this

  1. The Front-end application will be Server side rendered (To reduce web sockets latency)
  2. There will be multiple instances of the Back-end App with Load balances.

So we can serve many users at the same time.

Yes, there will be multiples connections, also we can't serve multiple users from a single sourcekit-lsp process? can we?

We can do something like this when WebSocket connection opens we spawn sourcekit-lsp and when socket connection closes we close sourcekit-lsp process.

(Satish) #4

thanks, for now i had integrated sourcekit-lsp with monaco, and now moving forward to integration inside the playground.