Skip to content

Commit c2a07b4

Browse files
committed
only call getValue when needed, microsoft#37539
1 parent 4a601ee commit c2a07b4

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/vs/platform/contextkey/browser/contextKeyService.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import { KeybindingResolver } from 'vs/platform/keybinding/common/keybindingReso
1010
import { IContextKey, IContext, IContextKeyServiceTarget, IContextKeyService, SET_CONTEXT_COMMAND_ID, ContextKeyExpr, IContextKeyChangeEvent } from 'vs/platform/contextkey/common/contextkey';
1111
import { IConfigurationService, IConfigurationChangeEvent, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
1212
import Event, { Emitter, debounceEvent } from 'vs/base/common/event';
13+
import { IConfigurationRegistry, Extensions } from 'vs/platform/configuration/common/configurationRegistry';
14+
import { Registry } from 'vs/platform/registry/common/platform';
1315

1416
const KEYBINDING_CONTEXT_ATTR = 'data-keybinding-context';
1517

@@ -94,9 +96,11 @@ class ConfigAwareContextValuesContainer extends Context {
9496
const configKeys: { [key: string]: boolean } = Object.create(null);
9597

9698
// add/update keys
97-
for (const key of this._configurationService.keys().default) {
98-
const value = this._configurationService.getValue(key);
99-
if (typeof value === 'boolean') {
99+
const configProps = Registry.as<IConfigurationRegistry>(Extensions.Configuration).getConfigurationProperties();
100+
for (const key in configProps) {
101+
const node = configProps[key];
102+
if (node.type === 'boolean') {
103+
const value = this._configurationService.getValue(key);
100104
const configKey = prefix + key;
101105
const oldValue = this._value[configKey];
102106
this._value[configKey] = value;

0 commit comments

Comments
 (0)