Python types for Language Server Protocol.
Project Links
Meta
Author: Microsoft Corporation
Maintainer: Brett Cannon, Karthik Nadig
Requires Python: >=3.8
Classifiers
Development Status
- 4 - Beta
License
- OSI Approved :: MIT License
Programming Language
- Python
- Python :: 3.8
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: Implementation :: CPython
- Python :: Implementation :: PyPy
Language Server Protocol Types implementation for Python
lsprotocol is a Python implementation of object types used in the Language Server Protocol (LSP). This repository contains the code generator and the generated types for LSP.
Overview
LSP is used by editors to communicate with various tools to enables services like code completion, documentation on hover, formatting, code analysis, etc. The intent of this library is to allow you to build on top of the types used by LSP. This repository will be kept up to date with the latest version of LSP as it is updated.
Installation
python -m pip install lsprotocol
Usage
Using LSP types
from lsprotocol import types
position = types.Position(line=10, character=3)
Using built-in type converters
# test.py
import json
from lsprotocol import converters, types
position = types.Position(line=10, character=3)
converter = converters.get_converter()
print(json.dumps(converter.unstructure(position, unstructure_as=types.Position)))
Output:
> python test.py
{"line": 10, "character": 3}
2025.0.0
Jun 17, 2025
2025.0.0rc1
Jun 02, 2025
2024.0.0b1
Oct 04, 2024
2024.0.0a2
Aug 13, 2024
2024.0.0a1
Jan 17, 2024
2023.0.1
Jan 09, 2024
2023.0.0
Nov 16, 2023
2023.0.0b1
Sep 18, 2023
2023.0.0a3
Aug 28, 2023
2023.0.0a2
Jun 21, 2023
2023.0.0a1
Mar 03, 2023
2023.0.0a0
Mar 02, 2023
2022.0.0a10
Jan 11, 2023
2022.0.0a9
Nov 09, 2022
2022.0.0a8
Nov 08, 2022
2022.0.0a7
Nov 01, 2022
2022.0.0a6
Oct 19, 2022
2022.0.0a5
Oct 07, 2022
2022.0.0a4
Aug 26, 2022
2022.0.0a3
Aug 19, 2022
2022.0.0a2
Aug 09, 2022
2022.0.0a1
Jul 20, 2022
2022.0.0a0
Jul 13, 2022