Skip to main content

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 poetry for 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


Download files

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

Source Distribution

lsp_types-0.6.0.tar.gz (55.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lsp_types-0.6.0-py3-none-any.whl (56.7 kB view details)

Uploaded Python 3

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

Hashes for lsp_types-0.6.0.tar.gz
Algorithm Hash digest
SHA256 dd214bb915bb2114f75386afa03556d47093e4947d48b947702d739c4159cfa0
MD5 5a2f7e022061ccc7ea6031821158b9f5
BLAKE2b-256 e77e2c3746bdf4851c4ea0ab00a7b02d824e02bfb934ecd867848591ed36f4de

See more details on using hashes here.

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

Hashes for lsp_types-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c856c65a655478332332190908cae64a6dc9e66b2bfb69dba573b6117259c234
MD5 b9fe3a88f3d35f43c1b7ad691587bad7
BLAKE2b-256 7596e7932c446f6ddfeaaf9f06ac96c68e054606a1314a644d438c3c08f33791

See more details on using hashes here.

Supported by

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