What is LSP?
The Language Server Protocol (LSP) provides language intelligence features such as:- Code Completion - Context-aware suggestions while typing
- Document Symbols - Navigate functions, classes, and variables
- Workspace Symbols - Search symbols across entire project
- Diagnostics - Real-time error and warning detection
LSP Server Management
Start LSP Server
Start a Language Server for a specific programming language.
Supported Languages:
typescript/javascriptpythongorustjava- And others depending on server availability
Stop LSP Server
Stop a running Language Server.Document Lifecycle
Open Document
Notify the LSP server that a document has been opened.Close Document
Notify the LSP server that a document has been closed.Code Intelligence
Get Code Completions
Get code completion suggestions at a specific position.
Context Object:
Response:
1- Text2- Method3- Function4- Constructor5- Field6- Variable7- Class8- Interface- And more…
Get Document Symbols
Retrieve all symbols (functions, classes, variables) in a document.
Response:
1- File2- Module5- Class6- Method12- Function13- Variable- And more…
Search Workspace Symbols
Search for symbols across the entire workspace.
Response:
Data Structures
Position
Represents a position in a document.Range
Represents a range in a document.Location
Represents a location in a document.Best Practices
- Always call
did-openbefore requesting completions for a document - Call
did-closewhen done with a document to free resources - Use workspace symbols for cross-file navigation
- Handle incomplete completion lists by requesting more items
- Stop LSP servers when no longer needed to conserve resources
Example Workflow
Prefer using the official Daytona SDKs over direct API calls for better type safety and LSP feature support.