src/vs/platform/policy/common/nativeManagedSettingsIpc.ts

79 LOC · 64 covered · 15 uncovered · 16 ranges · 12 concepts · 4 introducers · 7 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the filesrc/vs/platform/policy/node/nativeManagedSettingsService.ts · 141 LOCnode/nativeManagedSettin…nativeManagedSettingsService.test|title=NativeManagedSettingsService keeps raw managed settings while definitions are unchanged|occurrence=1 · 0 introduced LOCnativeManagedSettingsSer…nativeManagedSettingsService.ts ×2 · 6 introduced LOCnativeManagedSettingsSer…nativeManagedSettingsService.test|title=NativeManagedSettingsService removes raw managed settings whose definitions are no longer watched|occurrence=1 · 0 introduced LOCnativeManagedSettingsSer…nativeManagedSettingsService.ts ×2 · 7 introduced LOCnativeManagedSettingsSer…nativeManagedSettingsService.ts ×11 · 45 introduced LOCnativeManagedSettingsSer…nativeManagedSettingsIpc.ts ×1 · 2 introduced LOCnativeManagedSettingsIpc…nativeManagedSettingsIpc.ts ×3 · 7 introduced LOCnativeManagedSettingsIpc…nativeManagedSettingsIpc.ts ×5 · 12 introduced LOCnativeManagedSettingsIpc…nativeManagedSettingsService.test|title=NativeManagedSettingsService does not create the watcher until a managed-settings policy definition is registered|occurrence=1 · 0 introduced LOCnativeManagedSettingsSer…nativeManagedSettingsService.ts ×1 · 2 introduced LOCnativeManagedSettingsSer…nativeManagedSettingsService.ts ×3 · 11 introduced LOCnativeManagedSettingsSer…nativeManagedSettingsIpc.ts ×7 · 105 introduced LOCnativeManagedSettingsIpc…nativeManagedSettingsService.test|title=NativeManagedSettingsService channel client keeps newer event state when initial snapshot resolves later|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/policy/test/node/nativeManagedSettingsService.test|title=NativeManagedSettingsService channel client keeps newer event state when initial snapshot resolves later|occurrence=1nativeManagedSettingsSer…nativeManagedSettingsService.test|title=NativeManagedSettingsService channel client updatePolicyDefinitions updates cache without firing change event|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/policy/test/node/nativeManagedSettingsService.test|title=NativeManagedSettingsService channel client updatePolicyDefinitions updates cache without firing change event|occurrence=1nativeManagedSettingsSer…nativeManagedSettingsService.test|title=NativeManagedSettingsService clears stale watcher values when managed-settings definitions are removed|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/policy/test/node/nativeManagedSettingsService.test|title=NativeManagedSettingsService clears stale watcher values when managed-settings definitions are removed|occurrence=1nativeManagedSettingsSer…nativeManagedSettingsService.test|title=NativeManagedSettingsService does not create the watcher until a managed-settings policy definition is registered|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/policy/test/node/nativeManagedSettingsService.test|title=NativeManagedSettingsService does not create the watcher until a managed-settings policy definition is registered|occurrence=1nativeManagedSettingsSer…nativeManagedSettingsService.test|title=NativeManagedSettingsService keeps raw managed settings while definitions are unchanged|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/policy/test/node/nativeManagedSettingsService.test|title=NativeManagedSettingsService keeps raw managed settings while definitions are unchanged|occurrence=1nativeManagedSettingsSer…nativeManagedSettingsService.test|title=NativeManagedSettingsService removes raw managed settings whose definitions are no longer watched|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/policy/test/node/nativeManagedSettingsService.test|title=NativeManagedSettingsService removes raw managed settings whose definitions are no longer watched|occurrence=1nativeManagedSettingsSer…nativeManagedSettingsService.test|title=NativeManagedSettingsService watches managed-settings keys from policy definitions and exposes raw managed settings|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/policy/test/node/nativeManagedSettingsService.test|title=NativeManagedSettingsService watches managed-settings keys from policy definitions and exposes raw managed settings|occurrence=1nativeManagedSettingsSer…Focused file · src/vs/platform/policy/common/nativeManagedSettingsIpc.ts · 79 LOCcommon/nativeManagedSett…

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 > /*--------------------------------------------------------------------------------------------- nativeManagedSettingsIpc.ts ×7
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { Emitter, Event } from '../../../base/common/event.js';
7 > import { IStringDictionary } from '../../../base/common/collections.js';
8 > import { Disposable, DisposableStore } from '../../../base/common/lifecycle.js';
9 > import { equals } from '../../../base/common/objects.js';
10 > import { IChannel, IServerChannel } from '../../../base/parts/ipc/common/ipc.js';
11 > import { INativeManagedSettingsService, ManagedSettingsData } from './copilotManagedSettings.js';
12 > import { PolicyDefinition } from './policy.js';
13 >
14 > export class NativeManagedSettingsChannel implements IServerChannel {
15 >
16 > private readonly disposables = new DisposableStore();
17 >
18 > constructor(private readonly service: INativeManagedSettingsService) { }
19 >
20 > listen<T>(_: unknown, event: string): Event<T> {
21 switch (event) {
22 case 'onDidChangeManagedSettings': return this.service.onDidChangeManagedSettings as Event<T>;
23 }
24
25 throw new Error(`Event not found: ${event}`);
26 }
28 > call<T>(_: unknown, command: string, arg?: unknown): Promise<T> {
29 switch (command) {
30 case 'getManagedSettings': return Promise.resolve(this.service.managedSettings as T);
31 case 'updatePolicyDefinitions': return this.service.updatePolicyDefinitions(arg as IStringDictionary<PolicyDefinition>) as Promise<T>;
32 }
33
34 throw new Error(`Call not found: ${command}`);
35 }
37 > dispose(): void {
38 this.disposables.dispose();
39 }
41 >
42 > export class NativeManagedSettingsChannelClient extends Disposable implements INativeManagedSettingsService {
43 >
44 > readonly _serviceBrand: undefined;
45 >
46 > private _managedSettings: ManagedSettingsData = {};
47 > get managedSettings(): ManagedSettingsData { return this._managedSettings; }
48 > private hasReceivedManagedSettings = false;
49 >
50 > private readonly _onDidChangeManagedSettings = this._register(new Emitter<ManagedSettingsData>());
51 > readonly onDidChangeManagedSettings = this._onDidChangeManagedSettings.event;
52 >
53 > constructor(private readonly channel: IChannel) {
55 > this._register(this.channel.listen<ManagedSettingsData>('onDidChangeManagedSettings')(managedSettings => this.updateManagedSettings(managedSettings, true)));
56 > this.channel.call<ManagedSettingsData>('getManagedSettings').then(managedSettings => {
57 > if (!this.hasReceivedManagedSettings) {
58 > this.updateManagedSettings(managedSettings, true); nativeManagedSettingsIpc.ts ×3
59 > }
61 > }
63 > async updatePolicyDefinitions(policyDefinitions: IStringDictionary<PolicyDefinition>): Promise<ManagedSettingsData> {
64 > this.updateManagedSettings(await this.channel.call<ManagedSettingsData>('updatePolicyDefinitions', policyDefinitions), false); nativeManagedSettingsIpc.ts ×3
65 > return this._managedSettings;
66 > }
68 > private updateManagedSettings(managedSettings: ManagedSettingsData, fireEvent: boolean): void {
69 > this.hasReceivedManagedSettings = true; nativeManagedSettingsIpc.ts ×5
70 > if (equals(this._managedSettings, managedSettings)) {
72 > }
74 > this._managedSettings = managedSettings;
75 > if (fireEvent) {
76 > this._onDidChangeManagedSettings.fire(this._managedSettings); nativeManagedSettingsIpc.ts ×1
77 > }