LSP Client for AI Validation
Atmos includes an LSP client that connects to external Language Server Protocol (LSP) servers for file validation. This enables Atmos AI to detect syntax errors, validate YAML structure, and check Terraform/HCL syntax with precise line numbers and warnings.
For IDE integration (validation, autocomplete, hover docs), see the LSP Server.
The LSP Client connects to external language servers (yaml-language-server, terraform-ls) to validate generic YAML/Terraform/HCL syntax. It is used internally by Atmos AI via the validate_file_lsp tool β you don't interact with it directly.
How the LSP Client Worksβ
Atmos is an LSP client, not a server. It manages and communicates with external LSP servers (yaml-language-server, terraform-ls, etc.) to validate files when requested by Atmos AI.
Architecture:
βββββββββββββββββββββββ
β Atmos AI Chat β
β (ai chat, mcp) β
ββββββββββββ¬βββββββββββ
β
β validate_file_lsp tool
β
βββββββββββββββββββββββ
β Atmos LSP Client β
β (pkg/lsp/client) β
ββββββββββββ¬βββββββββββ
β
βββββββ΄ββββββ¬βββββββββββ
β β β
βββββββββββ βββββββββββ ββββββββββββ
β YAML LS β β TF LS β β JSON LS β
β(externalβ β(externalβ β(external β
β process)β β process)β β process) β
βββββββββββ βββββββββββ ββββββββββββ
Process Model:
- LSP servers run automatically in the background as child processes
- Servers start when Atmos needs to validate a file
- Servers shut down automatically when Atmos exits
- No manual server management required
Communication:
- Atmos communicates with LSP servers via stdin/stdout
- Each server runs as an independent subprocess
- All validation happens locally on your machine
Quick Startβ
Get started with LSP validation in 3 steps:
1. Install LSP Serversβ
Install the LSP servers you need:
These are standard LSP servers used by many editors. You may already have them installed if you use VS Code, Neovim, or other modern editors.
2. Enable LSP in atmos.yamlβ
Add LSP configuration to your atmos.yaml:
atmos.yaml
3. Use LSP Validation with Atmos AIβ
Once configured, Atmos AI can use LSP for file validation:
When you first enable LSP, Atmos will:
- Start LSP servers on-demand when AI requests validation (1-2 second startup)
- Cache validation results for fast subsequent checks
- Automatically clean up server processes on exit
The LSP client is used by Atmos AI via the validate_file_lsp tool.
Configuration Referenceβ
lsp.enabled- Enable LSP integration globally (default:
false) lsp.servers.{name}.command- Command to start the LSP server (must be in PATH or absolute path)
lsp.servers.{name}.args- Arguments to pass to the LSP server command
lsp.servers.{name}.filetypes- List of file extensions this server handles (e.g.,
["yaml", "yml"]) lsp.servers.{name}.root_patterns- Files/directories that identify the project root (e.g.,
[".git", "atmos.yaml"]) lsp.servers.{name}.initialization_options- Server-specific initialization options (varies by LSP server)
Supported LSP Serversβ
- yaml-language-server β YAML, YML
- Install:
npm install -g yaml-language-server. YAML validation and schemas. - terraform-ls β TF, TFVARS, HCL
- Install:
brew install terraform-ls. Terraform/HCL validation. - vscode-json-languageserver β JSON
- Install:
npm install -g vscode-json-languageserver. JSON validation and schemas.
Optional: Using LSP in Your Editorβ
You can optionally configure your code editor to use the same external LSP servers (yaml-ls, terraform-ls) that Atmos uses. This provides real-time editing features like autocomplete, hover documentation, and inline error checking while you edit Atmos files.
These editor configurations are entirely optional and separate from the Atmos LSP client described above. The Atmos LSP client works independently for AI validation regardless of your editor setup.
See the LSP Server Editor Configuration for detailed setup instructions for VS Code, Neovim, Zed, Helix, Sublime Text, Emacs, IntelliJ, Vim, Kate, Lapce, and Nova.
AI Integration Configurationβ
The LSP client is automatically available to Atmos AI when enabled. AI can use it for file validation via the validate_file_lsp tool.
Complete Configuration Exampleβ
atmos.yaml
AI Validation Exampleβ
See AI Configuration for more details on AI integration.