Host safety and recovery
An editor may request saving, closing, navigation, or language-service work; the host decides whether those effects are allowed. Protocol and source-derived text must be validated before terminal presentation, while failures and recovery remain visible in service state.
Focused usage
import { formatCodeEditorDiagnosticOverlay } from '@jsvision/code-editor';
const overlay = controller.presentation.assistance.overlay;
const safeRows = overlay === undefined ? [] : formatCodeEditorDiagnosticOverlay(overlay, i18n, 60);Safe terminal text
Sanitize diagnostic, hover, completion, symbol, filename, and host-detail presentation at the final terminal boundary. Keep the original payload as inert data only where it is genuinely needed, and never write it directly as terminal control bytes.
Project control-byte-laden diagnostic text into a clipped terminal-safe status without mutating the source payload.
Authorization and recovery
Denied effects must remain denied, failed sessions must stop publishing results, and recovery must create a clean ready state. Record only content-free events such as “save rejected” or “service recovered.”
Recover a failed in-process service through an explicit authorization step and inspect the bounded host event.
Limits and practices
- Allowlist host-effect kinds and check expected document revisions before acting.
- Never launch a process, connect to a network, or write a file merely because a demo requested it.
- Bound protocol arrays and text before they reach overlay or status layout.
- Cancel and dispose failed work before publishing a recovered coordinator/session.
Related
- Documents & lifecycle — own revision-aware external changes and saves.
- Language intelligence — validate protocol-shaped services.
clipCodeEditorDisplayTextAPI — generated presentation helper.