Merge from vscode cfc1ab4c5f816765b91fb7ead3c3427a7c8581a3

This commit is contained in:
ADS Merger
2020-03-11 04:19:23 +00:00
parent 16fab722d5
commit 4c3e48773d
880 changed files with 20441 additions and 11232 deletions

View File

@@ -230,15 +230,24 @@ interface IWorkbenchConstructionOptions {
* @param domElement the container to create the workbench in
* @param options for setting up the workbench
*/
let created = false;
async function create(domElement: HTMLElement, options: IWorkbenchConstructionOptions): Promise<void> {
// Assert that the workbench is not created more than once. We currently
// do not support this and require a full context switch to clean-up.
if (created) {
throw new Error('Unable to create the VSCode workbench more than once.');
} else {
created = true;
}
// Startup workbench
await main(domElement, options);
// Register commands if any
if (Array.isArray(options.commands)) {
for (const command of options.commands) {
CommandsRegistry.registerCommand(command.id, (accessor, ...args: any[]) => {
CommandsRegistry.registerCommand(command.id, (accessor, ...args) => {
// we currently only pass on the arguments but not the accessor
// to the command to reduce our exposure of internal API.
command.handler(...args);