mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-16 19:11:39 -04:00
Merge VS Code 1.31.1 (#4283)
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ICommandService, ICommandEvent, CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { Event, Emitter, filterEvent, toPromise } from 'vs/base/common/event';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
@@ -35,7 +35,7 @@ export class CommandService extends Disposable implements ICommandService {
|
||||
// we don't wait for it when the extension
|
||||
// host didn't yet start and the command is already registered
|
||||
|
||||
const activation: Thenable<any> = this._extensionService.activateByEvent(`onCommand:${id}`);
|
||||
const activation: Promise<any> = this._extensionService.activateByEvent(`onCommand:${id}`);
|
||||
const commandIsRegistered = !!CommandsRegistry.getCommand(id);
|
||||
|
||||
if (!this._extensionHostIsReady && commandIsRegistered) {
|
||||
@@ -46,7 +46,7 @@ export class CommandService extends Disposable implements ICommandService {
|
||||
waitFor = Promise.race<any>([
|
||||
// race activation events against command registration
|
||||
Promise.all([activation, this._extensionService.activateByEvent(`*`)]),
|
||||
toPromise(filterEvent(CommandsRegistry.onDidRegisterCommand, e => e === id)),
|
||||
Event.toPromise(Event.filter(CommandsRegistry.onDidRegisterCommand, e => e === id)),
|
||||
]);
|
||||
}
|
||||
return (waitFor as Promise<any>).then(_ => this._tryExecuteCommand(id, args));
|
||||
@@ -60,7 +60,7 @@ export class CommandService extends Disposable implements ICommandService {
|
||||
}
|
||||
try {
|
||||
this._onWillExecuteCommand.fire({ commandId: id });
|
||||
const result = this._instantiationService.invokeFunction.apply(this._instantiationService, [command.handler].concat(args));
|
||||
const result = this._instantiationService.invokeFunction.apply(this._instantiationService, [command.handler, ...args]);
|
||||
return Promise.resolve(result);
|
||||
} catch (err) {
|
||||
return Promise.reject(err);
|
||||
|
||||
@@ -18,9 +18,10 @@ class SimpleExtensionService implements IExtensionService {
|
||||
get onDidRegisterExtensions(): Event<void> {
|
||||
return this._onDidRegisterExtensions.event;
|
||||
}
|
||||
onDidChangeExtensionsStatus = null;
|
||||
onWillActivateByEvent = null;
|
||||
onDidChangeResponsiveChange = null;
|
||||
onDidChangeExtensionsStatus = null!;
|
||||
onDidChangeExtensions = null!;
|
||||
onWillActivateByEvent = null!;
|
||||
onDidChangeResponsiveChange = null!;
|
||||
activateByEvent(activationEvent: string): Promise<void> {
|
||||
return this.whenInstalledExtensionsRegistered().then(() => { });
|
||||
}
|
||||
@@ -31,7 +32,7 @@ class SimpleExtensionService implements IExtensionService {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
getExtensionsStatus() {
|
||||
return undefined;
|
||||
return undefined!;
|
||||
}
|
||||
getExtensions(): Promise<IExtensionDescription[]> {
|
||||
return Promise.resolve([]);
|
||||
@@ -54,6 +55,8 @@ class SimpleExtensionService implements IExtensionService {
|
||||
}
|
||||
stopExtensionHost(): void {
|
||||
}
|
||||
canAddExtension(): boolean { return false; }
|
||||
canRemoveExtension(): boolean { return false; }
|
||||
}
|
||||
|
||||
suite('CommandService', function () {
|
||||
@@ -138,7 +141,7 @@ suite('CommandService', function () {
|
||||
assert.equal(callCounter, 0);
|
||||
|
||||
let reg = CommandsRegistry.registerCommand('bar', () => callCounter += 1);
|
||||
resolveFunc(true);
|
||||
resolveFunc!(true);
|
||||
|
||||
return r.then(() => {
|
||||
reg.dispose();
|
||||
|
||||
Reference in New Issue
Block a user