Skip to main content

Python implementation of the Language Server Protocol.

Project description

Language Server Protocol Types implementation for Python

lsprotocol is a python implementation of object types used in the Language Server Protocol (LSP). This repository contains the code generator and the generated types for LSP.


LSP is used by editors to communicate with various tools to enables services like code completion, documentation on hover, formatting, code analysis, etc. The intent of this library is to allow you to build on top of the types used by LSP. This repository will be kept up to date with the latest version of LSP as it is updated.


python -m pip install lsprotocol


Using LSP types

from lsprotocol import types

position = types.Position(line=10, character=3)

Using built-in type converters

import json
from lsprotocol import converters, types

position = types.Position(line=10, character=3)
converter = converters.get_converter()
print(json.dumps(converter.unstructure(position, unstructure_as=types.Position)))


> python
{"line": 10, "character": 3}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lsprotocol-2023.0.0.tar.gz (69.4 kB view hashes)

Uploaded source

Built Distribution

lsprotocol-2023.0.0-py3-none-any.whl (70.8 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page