forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontextKeyManager.ts
More file actions
21 lines (17 loc) · 805 Bytes
/
contextKeyManager.ts
File metadata and controls
21 lines (17 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { inject, injectable } from 'inversify';
import { ExtensionContextKey } from './contextKeys';
import { ICommandManager, IContextKeyManager } from './types';
@injectable()
export class ContextKeyManager implements IContextKeyManager {
private values: Map<ExtensionContextKey, boolean> = new Map();
constructor(@inject(ICommandManager) private readonly commandManager: ICommandManager) {}
public async setContext(key: ExtensionContextKey, value: boolean): Promise<void> {
if (this.values.get(key) === value) {
return Promise.resolve();
}
this.values.set(key, value);
return this.commandManager.executeCommand('setContext', key, value);
}
}