GithubHelp home page GithubHelp logo

kolanich-libs / pygls Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openlawlibrary/pygls

0.0 1.0 0.0 1020 KB

a pythonic generic language server

Home Page: https://pygls.readthedocs.io/en/latest/

License: Apache License 2.0

Python 100.00%

pygls's Introduction

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.

pygls's People

Contributors

alcarney avatar anu-ka avatar augb avatar berquist avatar bollwyvl avatar brettcannon avatar d4n avatar danixeee avatar deathaxe avatar dimbleby avatar dinvlad avatar eirikpre avatar kolanich avatar matejkastak avatar mattst88 avatar maxattax97 avatar muffinmad avatar otreblan avatar pappasam avatar perimosocordiae avatar perrinjerome avatar renatav avatar rinx avatar tom-tan avatar yorodm avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.