mirror of
https://github.com/Microsoft/vscode
synced 2024-10-13 06:48:17 +00:00
Keep throwing but add a little more context, #30942
This commit is contained in:
parent
4b20d3e9bf
commit
a449cdf121
|
@ -21,13 +21,13 @@ export class Menu implements IMenu {
|
|||
private _onDidChange = new Emitter<IMenu>();
|
||||
|
||||
constructor(
|
||||
private id: MenuId,
|
||||
private _id: MenuId,
|
||||
startupSignal: TPromise<boolean>,
|
||||
@ICommandService private _commandService: ICommandService,
|
||||
@IContextKeyService private _contextKeyService: IContextKeyService
|
||||
) {
|
||||
startupSignal.then(_ => {
|
||||
const menuItems = MenuRegistry.getMenuItems(id);
|
||||
const menuItems = MenuRegistry.getMenuItems(_id);
|
||||
const keysFilter = new Set<string>();
|
||||
|
||||
let group: MenuItemGroup;
|
||||
|
@ -48,6 +48,9 @@ export class Menu implements IMenu {
|
|||
|
||||
// subscribe to context changes
|
||||
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) {
|
||||
if (keysFilter.has(k)) {
|
||||
this._onDidChange.fire();
|
||||
|
|
|
@ -126,7 +126,7 @@ class ContextKey<T> implements IContextKey<T> {
|
|||
}
|
||||
}
|
||||
|
||||
export abstract class AbstractContextKeyService {
|
||||
export abstract class AbstractContextKeyService implements IContextKeyService {
|
||||
public _serviceBrand: any;
|
||||
|
||||
protected _onDidChangeContext: Event<string[]>;
|
||||
|
@ -138,6 +138,8 @@ export abstract class AbstractContextKeyService {
|
|||
this._onDidChangeContextKey = new Emitter<string>();
|
||||
}
|
||||
|
||||
abstract dispose(): void;
|
||||
|
||||
public createKey<T>(key: string, defaultValue: T): IContextKey<T> {
|
||||
return new ContextKey(this, key, defaultValue);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue