python lsp
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: pygls
|
||||
Version: 1.3.1
|
||||
Summary: A pythonic generic language server (pronounced like 'pie glass')
|
||||
Home-page: https://github.com/openlawlibrary/pygls
|
||||
License: Apache-2.0
|
||||
Author: Open Law Library
|
||||
Author-email: info@openlawlib.org
|
||||
Maintainer: Tom BH
|
||||
Maintainer-email: tom@tombh.co.uk
|
||||
Requires-Python: >=3.8
|
||||
Classifier: License :: OSI Approved :: Apache Software License
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.8
|
||||
Classifier: Programming Language :: Python :: 3.9
|
||||
Classifier: Programming Language :: Python :: 3.10
|
||||
Classifier: Programming Language :: Python :: 3.11
|
||||
Classifier: Programming Language :: Python :: 3.12
|
||||
Provides-Extra: ws
|
||||
Requires-Dist: cattrs (>=23.1.2)
|
||||
Requires-Dist: lsprotocol (==2023.0.1)
|
||||
Requires-Dist: websockets (>=11.0.3) ; extra == "ws"
|
||||
Project-URL: Documentation, https://pygls.readthedocs.io/en/latest
|
||||
Project-URL: Repository, https://github.com/openlawlibrary/pygls
|
||||
Description-Content-Type: text/markdown
|
||||
|
||||
[](https://pypi.org/project/pygls/)   [](https://pygls.readthedocs.io/en/latest/)
|
||||
|
||||
# pygls: The Generic Language Server Framework
|
||||
|
||||
_pygls_ (pronounced like "pie glass") is a pythonic generic implementation of the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/specification) for use as a foundation for writing your own [Language Servers](https://langserver.org/) in just a few lines of code.
|
||||
|
||||
## Quickstart
|
||||
```python
|
||||
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:
|
||||
|
||||

|
||||
|
||||
## 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](https://github.com/openlawlibrary/pygls/blob/master/Implementations.md). 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](https://github.com/microsoft/vscode-languageserver-node). 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.
|
||||
* https://github.com/iamcco/diagnostic-languageserver
|
||||
* https://github.com/mattn/efm-langserver
|
||||
* https://github.com/jose-elias-alvarez/null-ls.nvim (Neovim only)
|
||||
|
||||
## Tests
|
||||
All Pygls sub-tasks require the Poetry `poe` plugin: https://github.com/nat-n/poethepoet
|
||||
|
||||
* `poetry install --all-extras`
|
||||
* `poetry run poe test`
|
||||
* `poetry run poe test-pyodide`
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
Your contributions to _pygls_ are most welcome ❤️ Please review the [Contributing](https://github.com/openlawlibrary/pygls/blob/master/CONTRIBUTING.md) and [Code of Conduct](https://github.com/openlawlibrary/pygls/blob/master/CODE_OF_CONDUCT.md) documents for how to get started.
|
||||
|
||||
## Donating
|
||||
|
||||
[Open Law Library](http://www.openlawlib.org/) is a 501(c)(3) tax exempt organization. Help us maintain our open source projects and open the law to all with [sponsorship](https://github.com/sponsors/openlawlibrary).
|
||||
|
||||
### Supporters
|
||||
|
||||
We would like to give special thanks to the following supporters:
|
||||
* [mpourmpoulis](https://github.com/mpourmpoulis)
|
||||
|
||||
## License
|
||||
|
||||
Apache-2.0
|
||||
|
||||
Reference in New Issue
Block a user