Debugging — LSP, DAP, and the VS Code Extension

← Back to Language Guide

Eta ships two cooperating processes for IDE integration:

BinaryProtocolPurpose
eta_lspLanguage Server ProtocolDiagnostics, completion, hover, navigation
eta_dapDebug Adapter ProtocolBreakpoints, stepping, inspection

The VS Code extension wires both into the editor and adds custom visualisations. See VS Code extension for installation.


Language Server (eta_lsp)

CapabilityNotes
DiagnosticsParse and macro-expansion errors
HoverFunction signatures, docstrings (when present)
Go-to definitionCross-module
Find referencesSymbol usage across the workspace
Document / workspace symbolsdefine, defun, define-syntax, exports
Auto-completionBindings in scope plus imported names
Signature helpParameter list of the call under the cursor

The server respects ETA_MODULE_PATH and any eta.modulePath setting in the workspace.


Debug Adapter (eta_dap)

eta_dap exposes the running VM over DAP. From VS Code, choose Run → Start Debugging with the Eta configuration.

Supported features

launch.json example

{
  "type": "eta",
  "request": "launch",
  "name": "Run current file",
  "program": "${file}",
  "stopOnEntry": false,
  "modulePath": ["${workspaceFolder}/stdlib"]
}

Important

Pre-v1.0 module preference in VS Code debugging

  • In debug sessions (eta_dap), Eta prefers .eta over .etac when both are present.
  • In normal run mode, Eta prefers .etac over .eta for module resolution.
  • Debugging with only .etac artifacts is supported, but source-level detail depends on whether the artifacts were built with debug metadata.
  • Freshness checks can still fall back from a stale .etac to a sibling .eta source file.
  • Planned for v1.0: the default debug preference is expected to switch to .etac.

VS Code panels

The extension adds three custom views:

ViewWhat it shows
Heap InspectorLive heap objects grouped by type, with structural drill-down
Disassembly ViewBytecode of the current frame with the program counter highlighted
GC Roots TreeAll registered GC roots — value stack, frame stack, intern table, finalizers

These views update on every DAP stopped event.


Diagnosing common problems

SymptomLikely cause
Stack overflow on linear recursionLost TCO — see Tail Calls
Actor recv! blocks foreverPeer never sent; or nng-close was missed
runtime.unbound after renameStale .etac cache — recompile with etac
Macro emits unexpected codeInspect etac --dump-expand file.eta
Heap grows unboundedLong-lived closure capturing a growing list — Heap Inspector helps locate the root