Skip to main content

a pythonic generic language server (pronounced like "pie glass").

Project description

pygls

PyPI Version Build Status !pyversions license Documentation Status

pygls (pronounced like "pie glass") is a pythonic generic implementation of the Language Server Protocol for use as a foundation for writing language servers using Python (e.g. Python, XML, etc.). It allows you to write your own language server in just a few lines of code.

Quick Intro

Here's how to create a server and register a code completion feature:

from pygls.server import LanguageServer
from lsprotocol.types import (
    TEXT_DOCUMENT_COMPLETION,
    CompletionItem,
    CompletionList,
    CompletionOptions,
    CompletionParams
)

server = LanguageServer('example-server', 'v0.1')

@server.feature(COMPLETION, CompletionOptions(trigger_characters=[',']))
def completions(params: CompletionParams):
    """Returns completion items."""
    return CompletionList(
        is_incomplete=False,
        items=[
            CompletionItem(label='"'),
            CompletionItem(label='['),
            CompletionItem(label=']'),
            CompletionItem(label='{'),
            CompletionItem(label='}'),
        ]
    )

server.start_tcp('127.0.0.1', 8080)

Show completion list on the client:

completions

Docs and Tutorial

The full documentation and a tutorial is available at https://pygls.readthedocs.io/en/latest/.

Let Us Know How You Are Using pygls

Submit a Pull Request (PR) with your information against the implementations document.

License

Apache-2.0

Contributing

Your contributions to pygls are welcome! Please review the Contributing and Code of Conduct documents for how to get started.

Donation

Open Law Library is a 501(c)(3) tax exempt organization.Help us maintain our open source projects and open the law to all with a donation.

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

pygls-1.0.0.tar.gz (682.3 kB view details)

Uploaded Source

Built Distribution

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

pygls-1.0.0-py3-none-any.whl (39.5 kB view details)

Uploaded Python 3

File details

Details for the file pygls-1.0.0.tar.gz.

File metadata

  • Download URL: pygls-1.0.0.tar.gz
  • Upload date:
  • Size: 682.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for pygls-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c2a1c22e30028f7ca9d3f0a04da8eef29f0f1701bdbd97d8614d8e1e6711f336
MD5 5f479fa55a17a414d13a03ae29d80129
BLAKE2b-256 da72f862cf178a076a3d63174c98c82f7b526b3d709c3ea184c763e745027597

See more details on using hashes here.

File details

Details for the file pygls-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pygls-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 39.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for pygls-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3414594ac29ff3ab990f004c675d1077e4e2659eae5cc3ae67cc6fa4d861e342
MD5 078afe864ac1f84e740e898b102a3821
BLAKE2b-256 8591583946b8a1b7eb4d4dc22776128512994c60da6c9dfa4b5d6597b0bf8b62

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