Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use lsprotocol's converter for (de)serialization
This simplifies much of the (de)serialization code by relying on the converter provided by `lsprotocol`. We use the `METHOD_TO_TYPES` mapping to determine which type definition to use for any given message. If a method is not known (as in the case of custom lsp commands) we fall back to pygls's existing generic RPC message classes. The following changes to the base `JsonRPCProtocol` class have also been made - server and client futures have been unified into a single `_request_futures` dict. - upon sending a request, the corresponding result type is looked up and stored in an internal `_result_types` dict. - (de)serialization code has been moved to a method on the `JsonRPCProtocol` class itself so that it has access to the required internal state. - subclasses (such as the `LanguageServerProtocol` class) are now required to implement the `get_message_type` and `get_result_type` methods to provide the type definitions corresponding with the given RPC method name.
- Loading branch information