Skip to content

Commit f77e68d

Browse files
author
Benjamin Pasero
committed
web - return result from commands
1 parent 6f5c2d4 commit f77e68d

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/vs/workbench/workbench.web.api.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,13 @@ interface ICommand {
7373
id: string,
7474

7575
/**
76-
* A function that is being executed with any arguments passed over.
76+
* A function that is being executed with any arguments passed over. The
77+
* return type will be send back to the caller.
78+
*
79+
* Note: arguments and return type should be serializable so that they can
80+
* be exchanged across processes boundaries.
7781
*/
78-
handler: (...args: any[]) => void;
82+
handler: (...args: any[]) => unknown;
7983
}
8084

8185
interface IWorkbenchConstructionOptions {
@@ -217,7 +221,7 @@ async function create(domElement: HTMLElement, options: IWorkbenchConstructionOp
217221
CommandsRegistry.registerCommand(command.id, (accessor, ...args) => {
218222
// we currently only pass on the arguments but not the accessor
219223
// to the command to reduce our exposure of internal API.
220-
command.handler(...args);
224+
return command.handler(...args);
221225
});
222226
}
223227
}

0 commit comments

Comments
 (0)