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

IMPORTANT NOTE:

In order to support type-checking, we added pydantic library which requires passing keyword arguments when creating LSP models.

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

from pygls.capabilities import COMPLETION
from pygls.server import LanguageServer
from pygls.lsp import 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-0.13.0.tar.gz (690.8 kB view details)

Uploaded Source

Built Distribution

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

pygls-0.13.0-py3-none-any.whl (88.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pygls-0.13.0.tar.gz
Algorithm Hash digest
SHA256 d76e44768d75805da26dfbaec187c6251450af4b7b1cc0b7eb3587e6e27e32a4
MD5 51cce2abfc1cd67fd0a119de2ee9d693
BLAKE2b-256 e4f9c888a9cb6e959e7619262e21c17bf7d9afcba31a29120a8bc2de4242a488

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pygls-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a018a007a3ca9079e060e5ebb88bfbbcc9157bac4f9ae45c5e24e569cbc93bd1
MD5 55c4b356ff2fc68091c77111ae247505
BLAKE2b-256 d3c6038711f27d1f471dffb83fa93b21c6f069663a913792a1d911869b8b4e29

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