Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 (#6381)

* Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973

* disable strict null check
This commit is contained in:
Anthony Dresser
2019-07-15 22:35:46 -07:00
committed by GitHub
parent f720ec642f
commit 0b7e7ddbf9
2406 changed files with 59140 additions and 35464 deletions

View File

@@ -12,7 +12,7 @@ import { revive } from 'vs/base/common/marshalling';
@extHostNamedCustomer(MainContext.MainThreadCommands)
export class MainThreadCommands implements MainThreadCommandsShape {
private readonly _disposables = new Map<string, IDisposable>();
private readonly _commandRegistrations = new Map<string, IDisposable>();
private readonly _generateCommandsDocumentationRegistration: IDisposable;
private readonly _proxy: ExtHostCommandsShape;
@@ -26,8 +26,8 @@ export class MainThreadCommands implements MainThreadCommandsShape {
}
dispose() {
this._disposables.forEach(value => value.dispose());
this._disposables.clear();
this._commandRegistrations.forEach(value => value.dispose());
this._commandRegistrations.clear();
this._generateCommandsDocumentationRegistration.dispose();
}
@@ -36,10 +36,9 @@ export class MainThreadCommands implements MainThreadCommandsShape {
return this._proxy.$getContributedCommandHandlerDescriptions().then(result => {
// add local commands
const commands = CommandsRegistry.getCommands();
for (let id in commands) {
let { description } = commands[id];
if (description) {
result[id] = description;
for (const [id, command] of commands) {
if (command.description) {
result[id] = command.description;
}
}
@@ -53,7 +52,7 @@ export class MainThreadCommands implements MainThreadCommandsShape {
}
$registerCommand(id: string): void {
this._disposables.set(
this._commandRegistrations.set(
id,
CommandsRegistry.registerCommand(id, (accessor, ...args) => {
return this._proxy.$executeContributedCommand(id, ...args).then(result => {
@@ -64,10 +63,10 @@ export class MainThreadCommands implements MainThreadCommandsShape {
}
$unregisterCommand(id: string): void {
const command = this._disposables.get(id);
const command = this._commandRegistrations.get(id);
if (command) {
command.dispose();
this._disposables.delete(id);
this._commandRegistrations.delete(id);
}
}
@@ -79,7 +78,7 @@ export class MainThreadCommands implements MainThreadCommandsShape {
}
$getCommands(): Promise<string[]> {
return Promise.resolve(Object.keys(CommandsRegistry.getCommands()));
return Promise.resolve([...CommandsRegistry.getCommands().keys()]);
}
}