Shared packages for building VS Code Python tool extensions (linters, formatters, type checkers).
Provides both a TypeScript npm package for the VS Code extension client and a Python pip package for the LSP server, enabling ~75-85% code reduction when building Python tool extensions.
| Package | Language | Install | Purpose |
|---|---|---|---|
vscode-python-tool-lsp |
TypeScript | npm install vscode-python-tool-lsp |
VS Code extension client: activation, settings, server lifecycle, Python env detection |
vscode-python-tool-lsp |
Python | pip install vscode-python-tool-lsp |
LSP server framework: parameterized server, execution engine, test utilities |
// extension.ts
import { activateToolExtension, deactivateToolExtension } from 'vscode-python-tool-lsp';
import { toolConfig } from './toolConfig';
export async function activate(context: vscode.ExtensionContext): Promise<void> {
await activateToolExtension(context, toolConfig);
}
export async function deactivate(): Promise<void> {
await deactivateToolExtension();
}# lsp_server.py
from vscode_python_tool_lsp import LSPToolServer, ToolServerConfig
config = ToolServerConfig(
tool_module="my_tool",
tool_display="My Tool",
is_formatter=False,
supports_notebook=True,
parse_output=my_parse_function,
# ... see docs for full config
)
server = LSPToolServer(config)
server.start()# TypeScript package
cd typescript
npm install
npm run build
npm test
# Python package
cd python
pip install -e ".[dev]"
pytestMIT License - See LICENSE for details.