LSP Devtools#
The LSP Devtools project provides a number of tools for making the the process of developing language servers easier.
Client Capability Index#
Important
This accuracy of this section entirely depends on the captured capabilities data that is bundled with pytest-lsp.
Pull requests for corrections and new data welcome!
Inspired by caniuse.com this provides information on which clients support which features of the LSP Specification.
lsp-devtools#
The lsp-devtools package provides a collection of CLI utilities that help inspect and visualise the interactions between a language client and a server.
See the Getting Started guide for details.
pytest-lsp#
pytest-lsp is a pytest plugin for writing end-to-end tests for language servers.
================================== test session starts ====================================
platform linux -- Python 3.11.2, pytest-7.2.0, pluggy-1.0.0
rootdir: /..., configfile: tox.ini
plugins: typeguard-2.13.3, asyncio-0.20.2, lsp-0.2.1
asyncio: mode=Mode.AUTO
collected 1 item
test_server.py F [100%]
======================================== FAILURES =========================================
____________________________________ test_completions _____________________________________
client = <pytest_lsp.client.LanguageClient object at 0x7f38f144a690>
...
E assert False
test_server.py:35: AssertionError
---------------------------- Captured window/logMessages call -----------------------------
LOG: Suggesting item 0
LOG: Suggesting item 1
LOG: Suggesting item 2
LOG: Suggesting item 3
LOG: Suggesting item 4
LOG: Suggesting item 5
LOG: Suggesting item 6
LOG: Suggesting item 7
LOG: Suggesting item 8
LOG: Suggesting item 9
================================ short test summary info ==================================
FAILED test_server.py::test_completions - assert False
=================================== 1 failed in 1.02s =====================================
It works by running the language server in a subprocess and communicating with it over stdio, just like a real language client.
This also means pytest-lsp
can be used to test language servers written in any language - not just Python.
pytest-lsp
relies on pygls for its language server protocol implementation.
See the Getting Started guide for details on how to write your first test case.