Giter Site home page Giter Site logo

seem / pygls Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openlawlibrary/pygls

0.0 0.0 0.0 1.7 MB

A pythonic generic language server

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

License: Apache License 2.0

JavaScript 0.33% Python 99.28% HTML 0.40%

pygls's Introduction

PyPI Version !pyversions license Documentation Status

pygls: The Generic Language Server Framework

pygls (pronounced like "pie glass") is a pythonic generic implementation of the Language Server Protocol for use as a foundation for writing your own Language Servers in just a few lines of code.

Quickstart

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

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

@server.feature(TEXT_DOCUMENT_COMPLETION)
def completions(params: CompletionParams):
    items = []
    document = server.workspace.get_document(params.text_document.uri)
    current_line = document.lines[params.position.line].strip()
    if current_line.endswith("hello."):
        items = [
            CompletionItem(label="world"),
            CompletionItem(label="friend"),
        ]
    return CompletionList(is_incomplete=False, items=items)

server.start_io()

Which might look something like this when you trigger autocompletion in your editor:

completions

Docs and Tutorial

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

Projects based on pygls

We keep a table of all known pygls implementations. Please submit a Pull Request with your own or any that you find are missing.

Alternatives

The main alternative to pygls is Microsoft's NodeJS-based Generic Language Server Framework. Being from Microsoft it is focussed on extending VSCode, although in theory it could be used to support any editor. So this is where pygls might be a better choice if you want to support more editors, as pygls is not focussed around VSCode.

There are also other Language Servers with "general" in their descriptons, or at least intentions. They are however only general in the sense of having powerful configuration. They achieve generality in so much as configuration is able to, as opposed to what programming (in pygls' case) can achieve.

Contributing

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

Donating

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 sponsorship.

Supporters

We would like to give special thanks to the following supporters:

License

Apache-2.0

pygls's People

Contributors

alcarney avatar augb avatar bollwyvl avatar brettcannon avatar danixeee avatar deathaxe avatar dependabot[bot] avatar dgreisen avatar dimbleby avatar dinvlad avatar eastonsuo avatar jelly avatar karthiknadig avatar kludex avatar kolanich avatar laurencewarne avatar matejkastak avatar mattst88 avatar maxattax97 avatar muffinmad avatar pappasam avatar perrinjerome avatar pschanely avatar renatav avatar rinx avatar seem avatar tom-tan avatar tombh avatar yaegassy avatar yorodm 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.