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:Close a Document
Notify the LSP server when closing a file: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:string
required
Path to the file
Position
required
Cursor position for completions
Symbol Search
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.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
Open documents before operations
Open documents before operations
Always call
didOpen() before getting completions or symbols for a file:Close documents when done
Close documents when done
Release resources by closing documents you’re no longer working with:
Stop server when finished
Stop server when finished
Always stop the LSP server to free resources:
Handle position carefully
Handle position carefully
Remember that line and character positions are zero-based:
Use Cases
Code Analysis
Code Analysis
Extract structure and symbols from codebases:
Intelligent Search
Intelligent Search
Find specific symbols across large projects:
Code Generation
Code Generation
Use completions to assist with code generation:
Refactoring Assistance
Refactoring Assistance
Identify symbols before performing refactoring:
Troubleshooting
Related Resources
Git Operations
Clone repositories for LSP analysis
File System
Search and manage source files