Need help with pygls?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

openlawlibrary
188 Stars 41 Forks Apache License 2.0 438 Commits 12 Opened issues

Description

a pythonic generic language server

Services available

!
?

Need anything else?

Contributors list

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](https://github.com/openlawlibrary/pygls/blob/master/CODEOFCONDUCT.md) 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.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.