AsyncLspClient
Source: leap0/_async/lsp.py
Signature
Section titled “Signature”AsyncLspClient(transport: AsyncTransport)Overview
Section titled “Overview”Start and interact with language servers for code intelligence inside a sandbox.
Supported languages: Python (pyright) and TypeScript/JavaScript (typescript-language-server).
The typical flow is start -> did_open -> completions or
document_symbols -> did_close -> stop.
Attributes: None.
Methods
Section titled “Methods”async start(sandbox: SandboxRef, *, language_id: str, path_to_project: str) -> LspResponseStart the LSP server for a language and project.
Spawns the server process and sends the LSP initialize handshake
automatically.
Args:
sandbox: Sandbox ID or object.
language_id: Language identifier ("python", "typescript", or "javascript").
path_to_project: Project directory path inside the sandbox.
Args:
sandbox: Sandbox ID or object.
language_id: Language identifier.
path_to_project: Project directory path.
uri: Document URI (e.g. "file:///home/user/project/main.py").
text: Full document text.
version: Document version number.
http_timeout: Optional HTTP request timeout in seconds for this SDK call.
Returns: LspResponse: Server startup result.
async stop(sandbox: SandboxRef, *, language_id: str, path_to_project: str) -> LspResponseSend shutdown and exit to the language server and terminate it.
Args: sandbox: Sandbox ID or object. language_id: Language identifier for the LSP operation. path_to_project: Project path inside the sandbox.
Returns: object: Result returned by this operation.
did_open
Section titled “did_open”async did_open(sandbox: SandboxRef, *, language_id: str, path_to_project: str, uri: str, text: str | None = None, version: int = 1, http_timeout: float | None = None) -> NoneNotify the language server that a document was opened.
Must be called before requesting completions or symbols.
Args: sandbox: Sandbox ID or object. language_id: Language identifier for the LSP operation. path_to_project: Project path inside the sandbox. uri: Document URI. text: Parameter for this operation. version: Parameter for this operation. http_timeout: Optional HTTP request timeout in seconds for this SDK call.
did_open_path
Section titled “did_open_path”async did_open_path(sandbox: SandboxRef, *, language_id: str, path_to_project: str, path: str, text: str | None = None, version: int = 1, http_timeout: float | None = None) -> NoneLike :meth:did_open but accepts a file path instead of a URI.
Args: http_timeout: Optional HTTP request timeout in seconds for this SDK call.
did_close
Section titled “did_close”async did_close(sandbox: SandboxRef, *, language_id: str, path_to_project: str, uri: str, http_timeout: float | None = None) -> NoneNotify the language server that a document was closed.
Args: sandbox: Sandbox ID or object. language_id: Language identifier for the LSP operation. path_to_project: Project path inside the sandbox. uri: Document URI.
did_close_path
Section titled “did_close_path”async did_close_path(sandbox: SandboxRef, *, language_id: str, path_to_project: str, path: str, http_timeout: float | None = None) -> NoneLike :meth:did_close but accepts a file path instead of a URI.
Args: http_timeout: Optional HTTP request timeout in seconds for this SDK call.
completions
Section titled “completions”async completions(sandbox: SandboxRef, *, language_id: str, path_to_project: str, uri: str, line: int, character: int, http_timeout: float | None = None) -> LspJsonRpcResponseRequest completions from the language server.
Args: http_timeout: Optional HTTP request timeout in seconds for this SDK call.
Returns: LspJsonRpcResponse: Raw JSON-RPC response payload.
completions_path
Section titled “completions_path”async completions_path(sandbox: SandboxRef, *, language_id: str, path_to_project: str, path: str, line: int, character: int, http_timeout: float | None = None) -> LspJsonRpcResponseLike :meth:completions but accepts a file path instead of a URI.
Args: http_timeout: Optional HTTP request timeout in seconds for this SDK call.
Returns: object: Result returned by this operation.
document_symbols
Section titled “document_symbols”async document_symbols(sandbox: SandboxRef, *, language_id: str, path_to_project: str, uri: str, http_timeout: float | None = None) -> LspJsonRpcResponseRequest document symbols from the language server.
Args: http_timeout: Optional HTTP request timeout in seconds for this SDK call.
Returns: LspJsonRpcResponse: Raw JSON-RPC response payload.
document_symbols_path
Section titled “document_symbols_path”async document_symbols_path(sandbox: SandboxRef, *, language_id: str, path_to_project: str, path: str, http_timeout: float | None = None) -> LspJsonRpcResponseLike :meth:document_symbols but accepts a file path instead of a URI.
Args: http_timeout: Optional HTTP request timeout in seconds for this SDK call.
Returns: object: Result returned by this operation.