Reference
Command reference
All commands are available in the Command Palette (Ctrl/Cmd+Shift+P), prefixed SN Widget.
Connection
| Command | What it does |
|---|---|
| Login to Instance | Creates a new instance profile: URL, auth method (Basic or OAuth2), credentials, environment (DEV / QA / PROD), then a profile name. Secrets stored in SecretStorage. Triggers a background Script Include sync and creates the instance folder |
| Switch Instance Profile | Switch between saved profiles, add a new instance, disconnect, or remove a profile — all from one picker (also on the status bar) |
| Remove Instance Profile | Deletes a saved profile and its stored secrets. For OAuth profiles, also revokes the token server-side and clears the in-editor ServiceNow session |
| Logout | Disconnects from the active instance but keeps the profile (and secrets) for a one-click reconnect |
Pull / Push
| Command | What it does |
|---|---|
| Pull Widget | Lists instance widgets (QuickPick) and downloads the chosen one to widgets/ |
| Pull All Widgets | Downloads all (with progress, cancelable) |
| Create New Widget (from template) | Wizard: pick a starting template (Blank / List+Detail / Form / Dashboard / Card / saved / import), then name, id and scope; creates the sp_widget on the instance, pulls it locally and opens it |
| Import Widget as Template | Saves an existing instance widget as a reusable template under .sn-widget-kit-templates/ |
| Push Current Widget | Reads the active editor's widget folder and pushes (PATCH). Runs through the Working Context guard and conflict detection |
| Toggle Auto-Sync | Turns automatic push-on-save on/off |
Update Set / Working Context
| Command | What it does |
|---|---|
| Select Application Scope | Sets your current application (apps.current_app), like the ServiceNow Application picker. The active Update Set is reflected/aligned to that scope |
| Select Update Set | Lists in-progress Update Sets in the current scope and sets the chosen one as current (via sys_user_preference) |
| Create Update Set | Creates a new Update Set (optionally scoped) on the instance and can set it active — no platform UI needed |
| Refresh Working Context | Re-reads scope + Update Set from the instance and re-aligns them (use after changing context in the ServiceNow browser UI) |
| Working Context Menu | Quick menu (from the status bar): select scope, select / create update set, refresh, toggle auto-sync, switch instance |
Preview / Hot Reload / Debug
| Command | What it does |
|---|---|
| Open Live Preview | Opens the widget's live preview with a toolbar (device sizes, refresh, hot-reload status). Connected to an instance it embeds the real ServiceNow preview through a localhost reverse proxy with an Instance ↔ Local toggle; offline it shows the local sandbox |
| Stop Live Preview | Stops the preview proxy |
| Debug Server Script | Opens the Server Script Debug Panel: runs server.js (using unsaved editor content) and shows logs, UI messages, errors with stack trace, timing and a run history |
| Start Hot-Reload Server | Starts the local HTTP+WebSocket server manually |
| Stop Hot-Reload Server | Stops the server |
| Refresh Portal Assets (CSS/Theme) | Re-fetches the portal CSS/theme for 1:1 visual fidelity in the preview |
| Snapshot Widget Data (for offline) | Runs server.js live and saves the resulting data to snapshot.json for offline development |
IntelliSense / Types
| Command | What it does |
|---|---|
| Reinstall IntelliSense Types | Rewrites the ServiceNow API .d.ts (gs, GlideRecord, $sp, ...). Normally installed automatically |
| Sync Instance Types (Script Includes) | Fetches all active Script Includes from the instance and generates .d.ts with declare class per scope |
| Diagnose Script Include | Diagnostic: why didn't a Script Include show up? (active, scope, ACL, parse, presence in the .d.ts) |