Merge VS Code 1.23.1 (#1520)

This commit is contained in:
Matt Irvine
2018-06-05 11:24:51 -07:00
committed by GitHub
parent e3baf5c443
commit 0c58f09e59
3651 changed files with 74249 additions and 48599 deletions

View File

@@ -54,7 +54,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
this._argumentProcessors.push(processor);
}
registerCommand(id: string, callback: <T>(...args: any[]) => T | Thenable<T>, thisArg?: any, description?: ICommandHandlerDescription): extHostTypes.Disposable {
registerCommand(global: boolean, id: string, callback: <T>(...args: any[]) => T | Thenable<T>, thisArg?: any, description?: ICommandHandlerDescription): extHostTypes.Disposable {
this._logService.trace('ExtHostCommands#registerCommand', id);
if (!id.trim().length) {
@@ -66,11 +66,15 @@ export class ExtHostCommands implements ExtHostCommandsShape {
}
this._commands.set(id, { callback, thisArg, description });
this._proxy.$registerCommand(id);
if (global) {
this._proxy.$registerCommand(id);
}
return new extHostTypes.Disposable(() => {
if (this._commands.delete(id)) {
this._proxy.$unregisterCommand(id);
if (global) {
this._proxy.$unregisterCommand(id);
}
}
});
}
@@ -112,6 +116,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
try {
validateConstraint(args[i], description.args[i].constraint);
} catch (err) {
// {{ SQL CARBON EDIT }} - Add type assertion to fix build break
return <any>Promise.reject(new Error(`Running the contributed command:'${id}' failed. Illegal argument '${description.args[i].name}' - ${description.args[i].description}`));
}
}
@@ -122,12 +127,14 @@ export class ExtHostCommands implements ExtHostCommandsShape {
return Promise.resolve(result);
} catch (err) {
this._logService.error(err, id);
// {{ SQL CARBON EDIT }} - Add type assertion to fix build break
return <any>Promise.reject(new Error(`Running the contributed command:'${id}' failed.`));
}
}
$executeContributedCommand<T>(id: string, ...args: any[]): Thenable<T> {
if (!this._commands.has(id)) {
// {{ SQL CARBON EDIT }} - Add type assertion to fix build break
return <any>Promise.reject(new Error(`Contributed command '${id}' does not exist.`));
} else {
args = args.map(arg => this._argumentProcessors.reduce((r, p) => p.processArgument(r), arg));
@@ -161,15 +168,16 @@ export class ExtHostCommands implements ExtHostCommandsShape {
export class CommandsConverter {
private readonly _delegatingCommandId: string;
private _commands: ExtHostCommands;
private _heap: ExtHostHeapService;
// --- conversion between internal and api commands
constructor(commands: ExtHostCommands, heap: ExtHostHeapService) {
this._delegatingCommandId = `_internal_command_delegation_${Date.now()}`;
this._commands = commands;
this._heap = heap;
this._commands.registerCommand('_internal_command_delegation', this._executeConvertedCommand, this);
this._commands.registerCommand(true, this._delegatingCommandId, this._executeConvertedCommand, this);
}
toInternal(command: vscode.Command): modes.Command {
@@ -190,7 +198,7 @@ export class CommandsConverter {
const id = this._heap.keep(command);
ObjectIdentifier.mixin(result, id);
result.id = '_internal_command_delegation';
result.id = this._delegatingCommandId;
result.arguments = [id];
}