Skip to main content
The Language Server Protocol (LSP) integration provides powerful code intelligence features including completions, symbol search, and code navigation within sandbox environments.

Overview

Daytona’s LSP support enables:
  • Code completions - Intelligent autocomplete suggestions
  • Symbol search - Find functions, classes, and variables across projects
  • Document symbols - Extract structure from source files
  • Multi-language support - TypeScript, JavaScript, and Python

Supported Languages

Daytona supports LSP for the following languages:

Creating an LSP Server

Initialize Language Server

Create and start an LSP server for your project:
LspLanguageId
required
Language server type: ‘typescript’, ‘javascript’, or ‘python’
string
required
Path to project root directory. Relative paths resolved from sandbox working directory.

Document Lifecycle

Open a Document

Notify the LSP server when opening a file:
Opening a document enables language features like diagnostics and completions for that file.

Close a Document

Notify the LSP server when closing a file:
Closing documents helps the LSP server manage resources efficiently.
string
required
Path to the file. Relative paths resolved from project path set in LSP server constructor.

Code Completions

Get Completion Suggestions

Retrieve intelligent completion suggestions at a cursor position:
Position Format:
Completion Response:
string
required
Path to the file
Position
required
Cursor position for completions

Document Symbols

Get all symbols (functions, classes, variables) from a document:

Workspace Symbols

Search for symbols across the entire sandbox:
workspaceSymbols() is deprecated. Use sandboxSymbols() instead.
Symbol Response:
string
required
Search query to match against symbol names

Complete Example

Language-Specific Setup

TypeScript / JavaScript

Ensure TypeScript LSP is installed:

Python

Ensure Python LSP is installed:

Best Practices

Always call didOpen() before getting completions or symbols for a file:
Release resources by closing documents you’re no longer working with:
Always stop the LSP server to free resources:
Remember that line and character positions are zero-based:

Use Cases

Extract structure and symbols from codebases:
Find specific symbols across large projects:
Use completions to assist with code generation:
Identify symbols before performing refactoring:

Troubleshooting

If you get “Invalid languageId” error, ensure you’re using one of the supported language IDs: 'python', 'typescript', or 'javascript'.
Make sure the LSP server for your language is installed in the sandbox image before calling start().

Git Operations

Clone repositories for LSP analysis

File System

Search and manage source files