Skip to main content

Atmos LSP Server

Experimental

The Atmos LSP Server enables IDE and editor integration for Atmos stack files. It provides real-time syntax validation, intelligent autocomplete, hover documentation, and error diagnostics directly in your editor as you work with Atmos configuration files.

tip

Looking for generic YAML/Terraform validation for Atmos AI? See the LSP Client, which connects to external language servers (yaml-ls, terraform-ls).

Features

Syntax Validation

The LSP server validates YAML syntax and Atmos-specific structure in real-time:

  • YAML syntax errors (invalid indentation, incorrect types)
  • Atmos structure validation (import arrays, component maps)
  • Component name validation
  • Variable structure validation
  • Precise error locations with line numbers

Basic Autocomplete

Get suggestions based on current line context:

  • Top-level keywords: import, components, vars, settings, metadata
  • Component types: terraform, helmfile
  • Stack configuration options
  • Import path suggestions
  • Variable definitions

Note: Completions are based on current line matching, not full YAML hierarchy parsing. For example, typing "comp" on a new line suggests "components".

Hover Documentation

Hover over Atmos keywords to see inline documentation explaining their purpose and usage.

Transport Options

The Atmos LSP Server supports multiple transport mechanisms:

  • stdio (default) - Standard input/output for local IDE integration
  • tcp - TCP server for remote connections
  • websocket - WebSocket server for web-based editors

Quick Start

Get started with Atmos LSP Server in 3 steps:

1. Start the LSP Server

Start the Atmos LSP Server with the default stdio transport:

shell

# Start LSP server (stdio transport for IDE integration)
atmos lsp start

# Or with TCP transport (for remote connections)
atmos lsp start --transport tcp --address localhost:7777

# Or with WebSocket transport (for web editors)
atmos lsp start --transport websocket --address localhost:8080
Transport Selection
  • stdio (default): Use for local IDE integration (VS Code, Neovim, etc.)
  • tcp: Use for remote development or when stdio isn't available
  • websocket: Use for web-based editors

2. Configure Your Editor

Configure your editor to connect to the Atmos LSP Server. See Editor Configuration below for specific examples.

3. Open Atmos Stack Files

Open any Atmos stack file (.yaml or .yml) in your editor and start getting real-time feedback!

Command Options

atmos lsp start

Starts the Atmos Language Server Protocol (LSP) server.

Flags:

--transport
Transport protocol: stdio, tcp, or websocket (default: stdio)
--address
Address for tcp/websocket transports in host:port format (default: localhost:7777)

Examples:

shell

# Start with stdio (default, for IDE integration)
atmos lsp start

# Explicitly specify stdio transport
atmos lsp start --transport stdio

# Start TCP server on default port
atmos lsp start --transport tcp

# Start TCP server on custom port
atmos lsp start --transport tcp --address localhost:9000

# Start WebSocket server
atmos lsp start --transport websocket --address localhost:8080

# Start WebSocket on a specific interface
atmos lsp start --transport websocket --address 127.0.0.1:8080

Editor Configuration

Configure your editor to connect to the Atmos LSP Server. The configuration varies by editor but follows a similar pattern: specify the command to start the server and which file types to activate for.

Create or update .vscode/settings.json in your workspace or use a VS Code extension.

Option 1: Using Generic LSP Extension

Install the vscode-language-server-client or create a custom extension.

.vscode/settings.json

{
"languageServerExample.trace.server": "verbose",
"atmos.lsp.enable": true,
"atmos.lsp.command": "atmos",
"atmos.lsp.args": ["lsp", "start", "--transport", "stdio"],
"atmos.lsp.filetypes": ["yaml", "yml"]
}

Option 2: Using tasks.json to Start Server

.vscode/tasks.json

{
"version": "2.0.0",
"tasks": [
{
"label": "Start Atmos LSP Server",
"type": "shell",
"command": "atmos",
"args": ["lsp", "start"],
"isBackground": true,
"problemMatcher": {
"pattern": {
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
},
"background": {
"activeOnStart": true,
"beginsPattern": "Starting Atmos LSP server",
"endsPattern": "LSP server ready"
}
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
}
}
]
}

Then configure the LSP client in settings.json:

.vscode/settings.json

{
"yaml.customTags": [],
"files.associations": {
"**/stacks/**/*.yaml": "yaml",
"**/stacks/**/*.yml": "yaml",
"atmos.yaml": "yaml"
}
}

Option 3: Create Custom VS Code Extension

For the best experience, create a custom VS Code extension. Create a new directory with:

package.json

{
"name": "atmos-lsp",
"displayName": "Atmos LSP Client",
"description": "Language Server Protocol client for Atmos",
"version": "0.1.0",
"engines": {
"vscode": "^1.75.0"
},
"categories": ["Programming Languages"],
"activationEvents": ["onLanguage:yaml"],
"main": "./out/extension.js",
"contributes": {
"configuration": {
"type": "object",
"title": "Atmos LSP",
"properties": {
"atmos.lsp.enabled": {
"type": "boolean",
"default": true,
"description": "Enable Atmos LSP server"
}
}
}
},
"dependencies": {
"vscode-languageclient": "^8.1.0"
}
}

src/extension.ts

import * as path from 'path';
import { workspace, ExtensionContext } from 'vscode';
import {
LanguageClient,
LanguageClientOptions,
ServerOptions
} from 'vscode-languageclient/node';

let client: LanguageClient;

export function activate(context: ExtensionContext) {
const serverOptions: ServerOptions = {
command: 'atmos',
args: ['lsp', 'start', '--transport', 'stdio']
};

const clientOptions: LanguageClientOptions = {
documentSelector: [
{ scheme: 'file', language: 'yaml', pattern: '**/stacks/**/*.{yaml,yml}' },
{ scheme: 'file', language: 'yaml', pattern: '**/atmos.yaml' }
],
synchronize: {
fileEvents: workspace.createFileSystemWatcher('**/*.{yaml,yml}')
}
};

client = new LanguageClient(
'atmosLsp',
'Atmos LSP Server',
serverOptions,
clientOptions
);

client.start();
}

export function deactivate(): Thenable<void> | undefined {
if (!client) {
return undefined;
}
return client.stop();
}

Editor Feature Matrix

VS Code
Setup: Easy. Autocomplete: Yes. Diagnostics: Yes. Hover: Yes. Go to Definition: Planned. Rating: Excellent.
Neovim
Setup: Moderate. Autocomplete: Yes. Diagnostics: Yes. Hover: Yes. Go to Definition: Planned. Rating: Excellent.
Vim (vim-lsp)
Setup: Moderate. Autocomplete: Yes. Diagnostics: Yes. Hover: Yes. Go to Definition: Planned. Rating: Great.
Vim (coc.nvim)
Setup: Easy. Autocomplete: Yes. Diagnostics: Yes. Hover: Yes. Go to Definition: Planned. Rating: Excellent.
Emacs (lsp-mode)
Setup: Moderate. Autocomplete: Yes. Diagnostics: Yes. Hover: Yes. Go to Definition: Planned. Rating: Excellent.
Emacs (eglot)
Setup: Easy. Autocomplete: Yes. Diagnostics: Yes. Hover: Yes. Go to Definition: Planned. Rating: Great.
Sublime Text
Setup: Easy. Autocomplete: Yes. Diagnostics: Yes. Hover: Yes. Go to Definition: Planned. Rating: Great.
IntelliJ IDEA
Setup: Moderate. Autocomplete: Yes. Diagnostics: Yes. Hover: Yes. Go to Definition: Planned. Rating: Good.
Cursor
Setup: Easy. Autocomplete: Yes. Diagnostics: Yes. Hover: Yes. Go to Definition: Planned. Rating: Excellent.
Zed
Setup: Easy. Autocomplete: Yes. Diagnostics: Yes. Hover: Yes. Go to Definition: Planned. Rating: Great.
Helix
Setup: Easy. Autocomplete: Yes. Diagnostics: Yes. Hover: Yes. Go to Definition: Planned. Rating: Great.

Legend: Yes = Fully supported. Planned = Stub implemented, will be enhanced in future versions. Rating: Excellent (highly recommended), Great (recommended), Good (acceptable).

Troubleshooting

LSP Server Not Starting

Symptoms:

  • Editor shows "LSP server failed to start"
  • No autocomplete or diagnostics appear

Solutions:

  1. Verify Atmos is installed and in PATH:

    which atmos
    atmos --version
  2. Test server manually:

    atmos lsp start --transport stdio
    # Should show: "Starting Atmos LSP server..."
  3. Check editor logs for errors:

    • VS Code: Output → Select "Atmos LSP" from dropdown
    • Neovim: :LspLog or :lua vim.lsp.set_log_level("debug")
    • Vim: Check :messages
    • Emacs: *lsp-log* buffer
  4. Ensure correct command syntax:

    # Correct
    atmos lsp start --transport stdio

    # Incorrect
    atmos lsp start --stdio # Wrong flag name

No Diagnostics Shown

Symptoms:

  • LSP server starts but no errors/warnings appear
  • Autocomplete works but validation doesn't

Solutions:

  1. Verify file is recognized as YAML:

    • Check file extension is .yaml or .yml
    • Verify editor recognizes file as YAML type
  2. Check LSP server is initialized:

    • Neovim: :LspInfo - should show "atmos_ls" or "atmos-lsp" as active
    • Vim: :LspStatus - should show server running
    • VS Code: Look for LSP indicator in status bar
  3. Introduce a known error to test:

    import: "not-an-array"  # Should error: import must be array
  4. Check Atmos logs:

    ATMOS_LOGS_LEVEL=Debug atmos lsp start --transport stdio

Autocomplete Not Working

Symptoms:

  • No suggestions appear when typing
  • Empty autocomplete menu

Solutions:

  1. Trigger autocomplete manually:

    • VS Code: Ctrl+Space
    • Neovim: Ctrl+X Ctrl+O (insert mode)
    • Vim: Ctrl+X Ctrl+O (insert mode)
    • Emacs: M-x completion-at-point
  2. Verify LSP capabilities:

    • Server should advertise completionProvider capability
    • Check with :LspInfo (Neovim) or editor's LSP diagnostics
  3. Check trigger characters:

    • Autocomplete triggers on: ., :, /
    • Try typing these characters after keywords
  4. Ensure omnifunc is set (Vim/Neovim):

    :set omnifunc?
    " Should show: omnifunc=lsp#complete or v:lua.vim.lsp.omnifunc

Server Crashes or Hangs

Symptoms:

  • LSP server stops responding
  • Editor shows "server disconnected"

Solutions:

  1. Check for large files:

    • LSP server may struggle with very large YAML files (>10,000 lines)
    • Try breaking up large stack files
  2. Restart the server:

    • VS Code: Cmd+Shift+P → "Reload Window"
    • Neovim: :LspRestart
    • Vim: Restart editor
  3. Check system resources:

    # Monitor CPU/memory usage
    top -p $(pgrep atmos)
  4. Enable debug logging:

    ATMOS_LOGS_LEVEL=Debug atmos lsp start --transport stdio 2>atmos-lsp.log
  5. Report issue:

TCP/WebSocket Connection Issues

Symptoms:

  • Editor can't connect to TCP/WebSocket server
  • Connection refused errors

Solutions:

  1. Verify server is running:

    # For TCP
    lsof -i :7777
    netstat -an | grep 7777

    # For WebSocket
    lsof -i :8080
    netstat -an | grep 8080
  2. Test connection manually:

    # For TCP
    telnet localhost 7777
    nc localhost 7777

    # For WebSocket
    curl -i -N -H "Connection: Upgrade" \
    -H "Upgrade: websocket" \
    http://localhost:8080
  3. Check firewall settings:

    # macOS
    sudo pfctl -sr | grep 7777

    # Linux
    sudo iptables -L | grep 7777
  4. Try different port:

    atmos lsp start --transport tcp --address localhost:9999

File Type Not Detected

Symptoms:

  • LSP doesn't activate for some YAML files
  • Works in some directories but not others

Solutions:

  1. Verify file associations in editor:

    • VS Code: Check files.associations in settings
    • Neovim: Check :set filetype?
    • Vim: Check :set filetype?
  2. Add explicit file pattern matching:

    • Configure editor to recognize all YAML files in project
    • Use patterns like **/stacks/**/*.yaml
  3. Check root directory detection:

    • LSP server looks for atmos.yaml or .git
    • Ensure one of these exists in project root
  4. Manually set file type:

    • Neovim/Vim: :set filetype=yaml
    • VS Code: Click language indicator in status bar

Security

  • stdio (default) — No network exposure. Most secure for local development.
  • tcp/websocket — Bind to localhost only. Use SSH tunneling for remote access. Never expose directly to the internet.

Limitations & Roadmap

Current Limitations

  • Go to Definition: Stub implemented, full implementation planned
  • Find References: Not yet implemented
  • Rename Symbol: Not yet implemented
  • Code Actions: Not yet implemented
  • Semantic Tokens: Not yet implemented