Skip to content

Language Server Protocol

The Daytona SDK provides Language Server Protocol (LSP) support through Sandbox instances. This enables advanced language features like code completion, diagnostics, and more.

Creating LSP Servers

Daytona SDK provides an option to create LSP servers in Python and TypeScript. The path_to_project argument is relative to the current Sandbox working directory when no leading / is used. The working directory is specified by WORKDIR when it is present in the Dockerfile, and otherwise falls back to the user’s home directory.

from daytona import Daytona, LspLanguageId
# Create Sandbox
daytona = Daytona()
sandbox = daytona.create()
# Create LSP server for Python
lsp_server = sandbox.create_lsp_server(
language_id=LspLanguageId.PYTHON,
path_to_project="workspace/project"
)

See: create_lsp_server (Python SDK), createLspServer (TypeScript SDK)

Supported Languages

The supported languages for creating LSP servers with the Daytona SDK are defined by the LspLanguageId enum:

Enum ValueDescription
LspLanguageId.PYTHONPython language server.
LspLanguageId.TYPESCRIPTTypeScript/JavaScript language server.

See: LspLanguageId (Python SDK), LspLanguageId (TypeScript SDK)

LSP Features

Daytona SDK provides LSP features for code analysis and editing.

Code Completion

Daytona SDK provides an option to get code completions for a specific position in a file using Python and TypeScript.

completions = lsp_server.completions(
path="workspace/project/main.py",
position={"line": 10, "character": 15}
)
print(f"Completions: {completions}")

See: completions (Python SDK), completions (TypeScript SDK)