Language Server Protocol
The Daytona SDK provides Language Server Protocol (LSP) support through workspace instances. This enables advanced language features like code completion, diagnostics, and more.
Creating LSP Servers
Daytona SDK provides an option to create LSP servers using Python and TypeScript.
from daytona_sdk import Daytona, LspLanguageId
# Create workspace
daytona = Daytona()workspace = daytona.create()
# Create LSP server for Python
lsp_server = workspace.create_lsp_server( language_id=LspLanguageId.PYTHON, path_to_project="/workspace/project")
import { Daytona, LspLanguageId } from '@daytonaio/sdk'
// Create workspaceconst daytona = new Daytona()const workspace = await daytona.create({ language: 'typescript'})
// Create LSP server for TypeScriptconst lspServer = workspace.createLspServer( LspLanguageId.TYPESCRIPT, "/workspace/project")
Supported Languages
Daytona SDK provides an option to create LSP servers for various languages through the LspLanguageId
enum in Python and TypeScript.
from daytona_sdk import LspLanguageId
# Available language IDs
LspLanguageId.PYTHONLspLanguageId.TYPESCRIPT
import { LspLanguageId } from '@daytonaio/sdk'
// Available language IDsLspLanguageId.PYTHONLspLanguageId.TYPESCRIPT
LspLanguageId.PYTHON
: Python language server.LspLanguageId.TYPESCRIPT
: TypeScript/JavaScript language server.
LSP Features
Daytona SDK provides various 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}")
const completions = await lspServer.getCompletions({ path: "/workspace/project/main.ts", position: { line: 10, character: 15 }})console.log('Completions:', completions)