Part V — The Modern Experience Layer · Chapter 30 · Lesson 1 of 2
The language server and editor tooling
The difference between a toy language and a tool you keep installed is the editor loop. PeaLang includes an LSP server and small diagnostics helpers you can use from the CLI or a program.
The LSP server
The current runtime exposes analysis.LSPServer and analysis.build_lsp_namespace() — a language server over stdio. It publishes diagnostics on open/change and advertises hover, completion, definition, document symbols and semantic tokens; it also has handlers for references, rename, code actions and inlay hints, but those are not advertised in initialize, and handle_definition() currently returns no location. An LSP-capable editor can connect to it; pea check remains the command-line check.
- Diagnostics: syntax and type findings inline in the editor.
- Hover and completion: type information, keywords, builtins and symbols in scope.
- Navigation: document outline via document symbols; reference and rename handlers exist but are not advertised in
initialize, and definition requests currently return no location.
pea doctor
pea doctor
# reports: python version, executable, platform, pealang version,
# optional dependency availability, project health totals
ux.doctor() is the same check from inside a program; it returns a JSON-friendly record, not a stack trace. It adds best-effort project health totals when a manifest or .pea files are present. No import is needed: ux is a built-in namespace.
ux.explain and ux.suggest
let hint = ux.explain("not found: main.pea")
let close = ux.suggest("docotr", ux.commands())
ux.explain(error, choices=None) appends actionable suggestions to an error string; ux.suggest(word, choices) returns close matches, and ux.commands() lists the CLI commands. Caught PeaLang errors are records with schema (pealang-error-v1), kind, message, code, source, line, column, cause, context, frames and trace.
Notebook display and web apps
For exploratory work, analysis.display_records, display_profile, display_model, display_evaluation, display_chart and display_report render values and analysis artifacts in notebooks. analysis.publish_as_webapp(source, title, template) generates a self-contained web app from a .pea script; see editors/vscode/ in the repo for editor integration.
Guided practice
- Run
pea doctorand read the JSON; share it when onboarding is mysteriously broken for someone. - Deliberately write a type error; confirm the LSP publishes it inline without running
pea check. - Call
ux.explainon an error message andux.suggeston a mistyped command name.