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()

@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-tagls-custom-0.0.1.tar.gz (137.4 kB view details)

Uploaded Source

Built Distribution

pygls_tagls_custom-0.0.1-py3-none-any.whl (87.0 kB view details)

Uploaded Python 3

File details

Details for the file pygls-tagls-custom-0.0.1.tar.gz.

File metadata

  • Download URL: pygls-tagls-custom-0.0.1.tar.gz
  • Upload date:
  • Size: 137.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.9

File hashes

Hashes for pygls-tagls-custom-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ed70755f77b35d216d8090fb67c4d428e423ed9798a35991e8dfbd41cd2c9885
MD5 90e3da8f7beff6a6902f43ca47e2e003
BLAKE2b-256 84fc553759319691e50d1f1266c4a291ec0ce8efab24f63f8db5fe2adabffa95

See more details on using hashes here.

File details

Details for the file pygls_tagls_custom-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pygls_tagls_custom-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 87.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.9

File hashes

Hashes for pygls_tagls_custom-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5ecedff6985dc851f9175a34f5f212aa80b4065f4fbe9fce609efcc239236841
MD5 df0798e283321b4a06e7015f89c65dc1
BLAKE2b-256 05e295c866dfb425be4cf7ec84e61c4297e77f617c0856540720ab0c7e45c73f

See more details on using hashes here.

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