Explains atopile's Language Server architecture and graph-based IDE features.

Install

mkdir -p .claude/skills/lsp && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4610" && unzip -o skill.zip -d .claude/skills/lsp && rm skill.zip

Installs to .claude/skills/lsp

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

How the atopile Language Server works (pygls), how it builds per-document graphs for completion/hover/defs, and the invariants for keeping it fast and crash-proof.
163 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Provide autocomplete for ato files
  • Enable go-to-definition navigation
  • Generate diagnostics for error reporting
  • Maintain per-document graph state
  • Execute partial compilation on incomplete code

How it works

The server uses pygls to manage document state and invokes the atopile compiler in a fault-tolerant mode to generate graphs for each open file. It retains the last successful build result to ensure IDE features remain functional during active editing.

Inputs & outputs

You give it
ato file content via stdio
You get back
LSP protocol messages for completion, hover, and diagnostics

When to use lsp

  • Developing new IDE features for atopile
  • Testing Language Server stability
  • Debugging hover and completion handlers
  • Optimizing per-document build results

About this skill

LSP Module

The lsp module (located in src/atopile/lsp/) implements the Language Server Protocol for atopile. It provides IDE features like autocomplete, go-to-definition, and diagnostics (error reporting) for ato files.

Quick Start

Run the server on stdio (what editors expect):

python -m atopile.lsp.lsp_server

Relevant Files

  • Server implementation: src/atopile/lsp/lsp_server.py
    • owns global LSP_SERVER (pygls LanguageServer)
    • maintains per-document DocumentState (graph/typegraph/build_result)
    • implements completion/hover/definition/diagnostics handlers
  • Utilities: src/atopile/lsp/lsp_utils.py
  • Optional debugging helper: src/atopile/lsp/_debug_server.py

Dependants (Call Sites)

  • VSCode Extension: The designated client for this server.
  • Compiler: The LSP invokes the compiler (often in a partial or fault-tolerant mode) to understand the code structure.

How to Work With / Develop / Test

Core Concepts

  • Partial Compilation: Unlike the CLI build, the LSP must handle broken or incomplete code without crashing.
  • Latency: Features must be fast (<50ms for typing, <200ms for completion).
  • Per-document graphs: each open document has an isolated GraphView + TypeGraph stored in DocumentState.
  • Keep last good build: the server keeps the last successful BuildFileResult to power completion/hover even when the current edit has errors.

Development Workflow

  1. Edit handlers/helpers in src/atopile/lsp/lsp_server.py.
  2. Run completion tests (fast loop) and verify GraphView cleanup paths.

Testing

  • Integration-style tests: ato dev test --llm test/test_lsp_completion.py -q

Best Practices

  • Robustness: Never let the server crash. Catch all exceptions in handlers and log them.
  • Debouncing: Don't trigger expensive operations on every keystroke.

Core Invariants (easy to regress)

  • Always destroy old graphs on rebuild/reset (DocumentState.reset_graph calls GraphView.destroy()).
  • Do not assume builds succeed; most features must handle:
    • syntax errors (ANTLR)
    • partial typegraphs
    • exceptions from linking/deferred execution

When not to use it

  • When full CLI build results are required instead of partial state
  • When operating outside of a standard editor environment expecting stdio

Prerequisites

python

Limitations

  • Requires manual cleanup of GraphView instances via DocumentState.reset_graph
  • Must maintain latency under 50ms for typing and 200ms for completion

How it compares

Unlike a standard CLI compiler that expects valid code, this server performs partial compilation to provide feedback on broken or incomplete files without crashing.

Compared to similar skills

lsp side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
lsp (this skill)25moReviewIntermediate
python-project-structure86moNo flagsBeginner
graph66moNo flagsAdvanced
library15moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry