Skip to content

Language servers

Diagnostics, definitions and references from a language server in the sandbox.

Every method shows the same operation in each SDK; pick a language once and every tab on the site follows it.

Python TypeScript Go Ruby Java

LanguageServers answers questions about one file with a real language server in the sandbox. Each call starts the server, asks and stops it, so no idle server is left to reap.

Python exposes these as methods; see below.

def completions(self, language: str, root: str, file: str, line: int, character: int, **options: Any) -> Any
Parameter Type Default
language str
root str
file str
line int
character int
options Any optional

Returns Any

Source: sdk/python/svm/lsp.py:125

Not in the Python SDK’s LanguageServers.

def definitions(self, language: str, root: str, file: str, line: int, character: int, **options: Any) -> Any
Parameter Type Default
language str
root str
file str
line int
character int
options Any optional

Returns Any

Source: sdk/python/svm/lsp.py:128
def diagnostics(self, language: str, root: str, file: str, **options: Any) -> list[dict[str, Any]]

The file’s diagnostics once the server has settled: its last publish, so an empty set published while the project loads is not taken for the answer. Raises errors.TimeoutError (error_kind “timeout”) when the server published nothing for the file within the driver’s wait (8 s) instead of answering []; query gives the raw answer, whose complete is then false.

Parameter Type Default
language str
root str
file str
options Any optional

Returns list[dict[str, Any]]

Raises TimeoutError

Source: sdk/python/svm/lsp.py:134
def egress_env(self) -> dict[str, str]

The proxy settings the install needs while the sandbox’s layer-7 egress is on, else {}.

With the firewall on, nothing leaves the sandbox except through its proxy, which signs with the sandbox’s CA: pip, npm, go and curl need the proxy URL (credentials included) and the CA in the variables each reads. They are read from get_sandbox_egress at each install and passed as the command’s environment, never on its command line; the CA is written owner-only to ~/.svm/egress-ca.pem of the installing user (root). Without the firewall, or without permission to read it, the install runs as it always did.

Returns dict[str, str]

Source: sdk/python/svm/lsp.py:61

Not in the Python SDK’s LanguageServers.

def install(self, language: str, *, timeout_seconds: int=600) -> None

Install the language server (and python3 for the driver) in the sandbox, as root.

Needs internet egress, or layer-7 egress rules that allow the package hosts (the install then goes through the sandbox’s proxy, see egress_env). It checks the free disk first and says so plainly when there is too little (MIN_FREE_MIB), instead of failing half way with ENOSPC.

Parameter Type Default
language str
timeout_seconds int 600
Source: sdk/python/svm/lsp.py:89
def query(self, language: str, root: str, file: str, ops: list[dict[str, Any]], *, server: list[str] | None=None, timeout: int=60) -> list[dict[str, Any]]
Parameter Type Default
language str
root str
file str
ops list[dict[str, Any]]
server list[str] | None None
timeout int 60

Returns list[dict[str, Any]]

Source: sdk/python/svm/lsp.py:107
def references(self, language: str, root: str, file: str, line: int, character: int, **options: Any) -> Any
Parameter Type Default
language str
root str
file str
line int
character int
options Any optional

Returns Any

Source: sdk/python/svm/lsp.py:131