提交 a449cdf1 编写于 作者: J Johannes Rieken

Keep throwing but add a little more context, #30942

上级 4b20d3e9
...@@ -21,13 +21,13 @@ export class Menu implements IMenu { ...@@ -21,13 +21,13 @@ export class Menu implements IMenu {
private _onDidChange = new Emitter<IMenu>(); private _onDidChange = new Emitter<IMenu>();
constructor( constructor(
private id: MenuId, private _id: MenuId,
startupSignal: TPromise<boolean>, startupSignal: TPromise<boolean>,
@ICommandService private _commandService: ICommandService, @ICommandService private _commandService: ICommandService,
@IContextKeyService private _contextKeyService: IContextKeyService @IContextKeyService private _contextKeyService: IContextKeyService
) { ) {
startupSignal.then(_ => { startupSignal.then(_ => {
const menuItems = MenuRegistry.getMenuItems(id); const menuItems = MenuRegistry.getMenuItems(_id);
const keysFilter = new Set<string>(); const keysFilter = new Set<string>();
let group: MenuItemGroup; let group: MenuItemGroup;
...@@ -48,6 +48,9 @@ export class Menu implements IMenu { ...@@ -48,6 +48,9 @@ export class Menu implements IMenu {
// subscribe to context changes // subscribe to context changes
this._disposables.push(this._contextKeyService.onDidChangeContext(keys => { this._disposables.push(this._contextKeyService.onDidChangeContext(keys => {
if (!keys) {
throw new Error(`Receiving bad onDidChangeContext-event form MenuId[${this._id.id}]`);
}
for (let k of keys) { for (let k of keys) {
if (keysFilter.has(k)) { if (keysFilter.has(k)) {
this._onDidChange.fire(); this._onDidChange.fire();
......
...@@ -126,7 +126,7 @@ class ContextKey<T> implements IContextKey<T> { ...@@ -126,7 +126,7 @@ class ContextKey<T> implements IContextKey<T> {
} }
} }
export abstract class AbstractContextKeyService { export abstract class AbstractContextKeyService implements IContextKeyService {
public _serviceBrand: any; public _serviceBrand: any;
protected _onDidChangeContext: Event<string[]>; protected _onDidChangeContext: Event<string[]>;
...@@ -138,6 +138,8 @@ export abstract class AbstractContextKeyService { ...@@ -138,6 +138,8 @@ export abstract class AbstractContextKeyService {
this._onDidChangeContextKey = new Emitter<string>(); this._onDidChangeContextKey = new Emitter<string>();
} }
abstract dispose(): void;
public createKey<T>(key: string, defaultValue: T): IContextKey<T> { public createKey<T>(key: string, defaultValue: T): IContextKey<T> {
return new ContextKey(this, key, defaultValue); return new ContextKey(this, key, defaultValue);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册