Skip to content

Checking your work in the window

Errors of widgets and init files mostly show only in the user’s window, so check there. Each step is a method an agent calls with omfp_call (workspaceId defaults to your workspace):

  1. Write the widget or the init file.
  2. workspaces.check: type-checks the init files and every widget, window module and live widget (views.mount code) with the files they import, against the declarations of omfp/sdk, omfp/kit and React, reporting <file>(<line>,<column>): error …; loads the init files in a throwaway host (what fails, what they declare); and renders every widget the workspace declares, then every live widget (a views.mount code mount, named mount <id>), out of sight in the most recently focused window showing it, with each one’s errors. windows.check_widget { widget } renders one widget; it also warns about native form controls. It resolves the name as the window does: the workspace’s widget first, then one the user’s init file declares. Without workspaceId it checks in the most recently focused window (or windowId), with or without a workspace: that is how to check the user’s widgets, or a shell slot module of the user’s init file (the widget shell.<slot>).
  3. workspaces.reload_init applies the init files.
  4. windows.list, then windows.state { windowId }: each window showing the workspace (most recently focused first) — its thread, its views (where each comes from: manifest, the workspace’s declared or live views; user_init or workspace_init, a window module; builtin, the core’s view while there is no valid manifest), their widgets, the active one, the commands window modules and widgets added with their keys, and its errors.
  5. windows.run { command: "view.switch", args: ["<view>"] } shows a view in that window (windowId picks one). Any registered command id or alias runs the same way, as :<command> <args> would. It never runs code: an unknown command, a disabled one or a failure comes back as the method’s error.
  6. windows.state again for the errors of what it shows now; fix and repeat.

Nothing of a check’s render appears on screen. Widgets and scripts call the same methods with workspaceId given.

Every view, widget, window module view and card must also work in the narrow (frame under 1100 px) and mobile (under 700 px, or a phone held sideways: one area at a time, the mode line at the top) layouts: read FRAME_LAYOUT and give way (omfp://docs/widgets, Rules). The check renders in the focused window’s layout only: check the result at a phone width too (a window under 700 px wide, or ask the user to look on their phone).