Zero-dependency Python library for Language Server Protocol types
Project description
LSP Types
Publish the excellent work of Sublime LSP as a PyPI package.
LSP Types is a Python package that aims to provide a fully typed interface to Language Server Protocol (LSP) interactions. It can be used to simply utilize the types, or to interact with an LSP server over stdio.
It is a goal to maintain zero-dependency status for as long as possible.
Installation
pip install lsp-types
Usage
Using the LSP types:
import lsp_types
# Use the types
Using an LSP session through stdio:
from lsp_types.session import LSPSession, ProcessLaunchInfo
process_info = ProcessLaunchInfo(cmd=[
"pyright-langserver", "--stdio"
])
async with LSPSession(process_info) as session:
# Initialize the session
...
# Grab a typed listener
diagnostics_listener = session.notify.on_publish_diagnostics(timeout=1.0)
# Send a notification
await session.notify.did_open_text_document(...)
# Wait for diagnostics to come in
diagnostics = await diagnostics_listener
Development
- Requires Python 3.11+.
- Requires
poetryfor dev dependencies.
Generate latest types in one go:
make generate-latest-types
Download the latest json schema:
make download-schemas
Generate the types:
make generate-schemas
Copy the lsp_types/types.py file to your project.
NOTE: Do not import types that begin with __. These types are internal types and are not meant to be used.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lsp_types-0.6.0.tar.gz.
File metadata
- Download URL: lsp_types-0.6.0.tar.gz
- Upload date:
- Size: 55.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.13.1 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd214bb915bb2114f75386afa03556d47093e4947d48b947702d739c4159cfa0
|
|
| MD5 |
5a2f7e022061ccc7ea6031821158b9f5
|
|
| BLAKE2b-256 |
e77e2c3746bdf4851c4ea0ab00a7b02d824e02bfb934ecd867848591ed36f4de
|
File details
Details for the file lsp_types-0.6.0-py3-none-any.whl.
File metadata
- Download URL: lsp_types-0.6.0-py3-none-any.whl
- Upload date:
- Size: 56.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.13.1 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c856c65a655478332332190908cae64a6dc9e66b2bfb69dba573b6117259c234
|
|
| MD5 |
b9fe3a88f3d35f43c1b7ad691587bad7
|
|
| BLAKE2b-256 |
7596e7932c446f6ddfeaaf9f06ac96c68e054606a1314a644d438c3c08f33791
|