rpc add
Extend a panel’s RPC contract: appends a method to its interface in
src/shared/api.ts and adds a handler stub in the panel.
vsceasy rpc add --panel dashboard --method getStats --returns "Promise<Stats>"Flags
| Flag | Type | Notes |
|---|---|---|
--panel | panel id | Required. Which panel to extend. |
--method | text | Required. Method name. |
--params | text | Param signature, e.g. id: string, q?: string. |
--returns | text | Return type. Default void. |
Examples
# no args, returns a valuevsceasy rpc add --panel dashboard --method getStats --returns "{ total: number }"
# with paramsvsceasy rpc add --panel users --method find --params "q: string" --returns "User[]"This adds to both sides:
export interface DashboardApi { getStats(): Promise<{ total: number }>; // ← added}rpc: (vscode) => ({ async getStats() { // TODO: implement return { total: 0 }; },}),Call it from the webview with full typing — see Typed RPC.