diff --git a/docs/source/index.rst b/docs/source/index.rst index 3fba7b6f..a3833603 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -8,35 +8,39 @@ `pygls`_ (pronounced like “pie glass”) is a generic implementation of the `Language Server Protocol`_ written in the Python programming language. It -allows you to write your own `language server`_ in just a few lines of code. +allows you to write your own `language server`_ in just a few lines of code:: -Features --------- + from pygls.server import LanguageServer + from lsprotocol import types -- cross-platform support -- TCP/IP and STDIO communication -- runs in asyncio event loop -- register LSP features and custom commands as: + server = LanguageServer("example-server", "v0.1") - - asynchronous functions (coroutines) - - synchronous functions - - functions that will be executed in separate thread + @server.feature(types.TEXT_DOCUMENT_COMPLETION) + def completions(params: types.CompletionParams): + items = [] + document = server.workspace.get_text_document(params.text_document.uri) + current_line = document.lines[params.position.line].strip() + if current_line.endswith("hello."): + items = [ + types.CompletionItem(label="world"), + types.CompletionItem(label="friend"), + ] + return types.CompletionList(is_incomplete=False, items=items) -- thread management -- in-memory workspace with *full* and *incremental* document updates -- type-checking -- good test coverage + if __name__ == "__main__": + server.start_io() -Python Versions ---------------- +*pygls* supports -*pygls* works with Python 3.8+. - -User Guide ----------- +- Python 3.8+ on Windows, MacOS and Linux +- STDIO, TCP/IP and WEBSOCKET communication +- Both sync and async styles of programming +- Running code in background threads +- Automatic text and notebook document syncronisation .. toctree:: - :maxdepth: 2 + :hidden: + :caption: User Guide pages/tutorial pages/user-guide @@ -64,6 +68,31 @@ User Guide history changelog + +The documentation is divided up into the following sections + +.. grid:: 1 2 2 2 + :gutter: 2 + + .. grid-item-card:: User Guide + :text-align: center + + Step-by-step guides on writing your first language server with *pygls*. + + .. grid-item-card:: How To Guides + :link: /howto + :link-type: doc + :text-align: center + + Short, focused articles on how to acheive a particular outcome + + .. grid-item-card:: API Reference + :columns: 12 + :text-align: center + + Comprehensive, detailed documentation on all of the features provided by *pygls*. + + .. _Language Server Protocol: https://microsoft.github.io/language-server-protocol/specification .. _Language server: https://langserver.org/ .. _pygls: https://github.com/openlawlibrary/pygls