You can follow the example in the main.rs on how to use the library, the benefit of this api is not having to deal with the json rpc protocol, you can just call the methods and get the results.
To run the example in main.rs:
- Install https://github.com/typescript-language-server/typescript-language-server
- Install the
lsp_client
binary usingcargo install --path .
- In a directory containing TypeScript files, run
lsp_client ./path/to/code.ts
LSP have a special JSON RPC protocol. It is not straightforward to use, and you probably want to make sure that the requests are handled correctly, so we are share our implementation in the hopes that others can use it for fun and profit.