SN Widget Kit logoSN Widget Kit
Docs

Reference

Command reference

All commands are available in the Command Palette (Ctrl/Cmd+Shift+P), prefixed SN Widget.

Connection

CommandWhat it does
Login to InstanceCreates 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 ProfileSwitch between saved profiles, add a new instance, disconnect, or remove a profile — all from one picker (also on the status bar)
Remove Instance ProfileDeletes a saved profile and its stored secrets. For OAuth profiles, also revokes the token server-side and clears the in-editor ServiceNow session
LogoutDisconnects from the active instance but keeps the profile (and secrets) for a one-click reconnect

Pull / Push

CommandWhat it does
Pull WidgetLists instance widgets (QuickPick) and downloads the chosen one to widgets/
Pull All WidgetsDownloads 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 TemplateSaves an existing instance widget as a reusable template under .sn-widget-kit-templates/
Push Current WidgetReads the active editor's widget folder and pushes (PATCH). Runs through the Working Context guard and conflict detection
Toggle Auto-SyncTurns automatic push-on-save on/off

Update Set / Working Context

CommandWhat it does
Select Application ScopeSets your current application (apps.current_app), like the ServiceNow Application picker. The active Update Set is reflected/aligned to that scope
Select Update SetLists in-progress Update Sets in the current scope and sets the chosen one as current (via sys_user_preference)
Create Update SetCreates a new Update Set (optionally scoped) on the instance and can set it active — no platform UI needed
Refresh Working ContextRe-reads scope + Update Set from the instance and re-aligns them (use after changing context in the ServiceNow browser UI)
Working Context MenuQuick menu (from the status bar): select scope, select / create update set, refresh, toggle auto-sync, switch instance

Preview / Hot Reload / Debug

CommandWhat it does
Open Live PreviewOpens 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 PreviewStops the preview proxy
Debug Server ScriptOpens 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 ServerStarts the local HTTP+WebSocket server manually
Stop Hot-Reload ServerStops 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

CommandWhat it does
Reinstall IntelliSense TypesRewrites 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 IncludeDiagnostic: why didn't a Script Include show up? (active, scope, ACL, parse, presence in the .d.ts)