configuration.ts ×14

Frontier kind: Code frontier

unlabeled · c_31781a6a6398

79 tests · 20212 LOC · 75 files · introduces 0 tests · 130 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
14 ranges130 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2045 ranges20212 lines · 75 files · Browse complete extent
All tests (intent)
79 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

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 native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 130 introduced LOC across 14 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/common/configuration.ts 130 introduced LOC · 14 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- configuration.ts
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 { localize } from '../../nls.js';
7 > import { ConfigurationScope, IConfigurationNode, IConfigurationRegistry, Extensions as ConfigurationExtensions } from '../../platform/configuration/common/configurationRegistry.js';
8 > import { Registry } from '../../platform/registry/common/platform.js';
9 > import { IWorkbenchContribution } from './contributions.js';
10 > import { IWorkspaceContextService, IWorkspaceFolder, WorkbenchState } from '../../platform/workspace/common/workspace.js';
11 > import { ConfigurationTarget, IConfigurationService, IConfigurationValue, IInspectValue } from '../../platform/configuration/common/configuration.js';
12 > import { Disposable } from '../../base/common/lifecycle.js';
13 > import { Emitter } from '../../base/common/event.js';
14 > import { IRemoteAgentService } from '../services/remote/common/remoteAgentService.js';
15 > import { OperatingSystem, isWindows } from '../../base/common/platform.js';
16 > import { URI } from '../../base/common/uri.js';
17 > import { equals } from '../../base/common/objects.js';
18 > import { DeferredPromise } from '../../base/common/async.js';
19 > import { IUserDataProfile, IUserDataProfilesService } from '../../platform/userDataProfile/common/userDataProfile.js';
20 >
21 > export const applicationConfigurationNodeBase = Object.freeze<IConfigurationNode>({
22 > 'id': 'application',
23 > 'order': 100,
24 > 'title': localize('applicationConfigurationTitle', "Application"),
25 > 'type': 'object'
26 > });
27 >
28 > export const workbenchConfigurationNodeBase = Object.freeze<IConfigurationNode>({
29 > 'id': 'workbench',
30 > 'order': 7,
31 > 'title': localize('workbenchConfigurationTitle', "Workbench"),
32 > 'type': 'object',
33 > });
34 >
35 > export const securityConfigurationNodeBase = Object.freeze<IConfigurationNode>({
36 > 'id': 'security',
37 > 'scope': ConfigurationScope.APPLICATION,
38 > 'title': localize('securityConfigurationTitle', "Security"),
39 > 'type': 'object',
40 > 'order': 7
41 > });
42 >
43 > export const problemsConfigurationNodeBase = Object.freeze<IConfigurationNode>({
44 > 'id': 'problems',
45 > 'title': localize('problemsConfigurationTitle', "Problems"),
46 > 'type': 'object',
47 > 'order': 101
48 > });
49 >
50 > export const windowConfigurationNodeBase = Object.freeze<IConfigurationNode>({
51 > 'id': 'window',
52 > 'order': 8,
53 > 'title': localize('windowConfigurationTitle', "Window"),
54 > 'type': 'object',
55 > });
56 >
57 > export const Extensions = {
58 > ConfigurationMigration: 'base.contributions.configuration.migration'
59 > };
60 >
61 > type ConfigurationValue = { value: unknown | undefined /* Remove */ };
62 > export type ConfigurationKeyValuePairs = [string, ConfigurationValue][];
63 > // eslint-disable-next-line @typescript-eslint/no-explicit-any
64 > export type ConfigurationMigrationFn = (value: any, valueAccessor: (key: string) => any) => ConfigurationValue | ConfigurationKeyValuePairs | Promise<ConfigurationValue | ConfigurationKeyValuePairs>;
65 > export type ConfigurationMigration = { key: string; migrateFn: ConfigurationMigrationFn };
66 >
67 > export interface IConfigurationMigrationRegistry {
68 > registerConfigurationMigrations(configurationMigrations: ConfigurationMigration[]): void;
69 > }
70 >
71 > class ConfigurationMigrationRegistry implements IConfigurationMigrationRegistry {
72 >
73 > readonly migrations: ConfigurationMigration[] = [];
74 >
75 > private readonly _onDidRegisterConfigurationMigrations = new Emitter<ConfigurationMigration[]>();
76 > readonly onDidRegisterConfigurationMigration = this._onDidRegisterConfigurationMigrations.event;
77 >
78 > registerConfigurationMigrations(configurationMigrations: ConfigurationMigration[]): void {
79 this.migrations.push(...configurationMigrations);
80 }
82 > }
83 >
84 > const configurationMigrationRegistry = new ConfigurationMigrationRegistry();
85 > Registry.add(Extensions.ConfigurationMigration, configurationMigrationRegistry);
86 >
87 > export class ConfigurationMigrationWorkbenchContribution extends Disposable implements IWorkbenchContribution {
88 >
89 > static readonly ID = 'workbench.contrib.configurationMigration';
90 >
91 > constructor(
92 @IConfigurationService private readonly configurationService: IConfigurationService,
93 @IWorkspaceContextService private readonly workspaceService: IWorkspaceContextService,
102 this._register(configurationMigrationRegistry.onDidRegisterConfigurationMigration(migration => this.migrateConfigurations(migration)));
103 }
105 > private async migrateConfigurations(migrations: ConfigurationMigration[]): Promise<void> {
106 await this.migrateConfigurationsForFolder(undefined, migrations);
107 for (const folder of this.workspaceService.getWorkspace().folders) {
109 }
110 }
112 > private async migrateConfigurationsForFolder(folder: IWorkspaceFolder | undefined, migrations: ConfigurationMigration[]): Promise<void> {
113 await Promise.all([migrations.map(migration => this.migrateConfigurationsForFolderAndOverride(migration, folder?.uri))]);
114 }
116 > private async migrateConfigurationsForFolderAndOverride(migration: ConfigurationMigration, resource?: URI): Promise<void> {
117 const inspectData = this.configurationService.inspect(migration.key, { resource });
118
160 }
161 }
163 > private async runMigration(migration: ConfigurationMigration, dataKey: keyof IConfigurationValue<unknown>, value: unknown, resource: URI | undefined, overrideIdentifiers: string[] | undefined): Promise<ConfigurationKeyValuePairs | undefined> {
164 const valueAccessor = (key: string) => {
165 const inspectData = this.configurationService.inspect(key, { resource });
176 return Array.isArray(result) ? result : [[migration.key, result]];
177 }
179 >
180 > export class DynamicWorkbenchSecurityConfiguration extends Disposable implements IWorkbenchContribution {
181 >
182 > static readonly ID = 'workbench.contrib.dynamicWorkbenchSecurityConfiguration';
183 >
184 > private readonly _ready = new DeferredPromise<void>();
185 > readonly ready = this._ready.p;
186 >
187 > constructor(
188 @IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService
189 ) {
192 this.create();
193 }
195 > private async create(): Promise<void> {
196 try {
197 await this.doCreate();
200 }
201 }
203 > private async doCreate(): Promise<void> {
204 if (!isWindows) {
205 const remoteEnvironment = await this.remoteAgentService.getEnvironment();
234 });
235 }
237 >
238 > export const CONFIG_NEW_WINDOW_PROFILE = 'window.newWindowProfile';
239 >
240 > export class DynamicWindowConfiguration extends Disposable implements IWorkbenchContribution {
241 >
242 > static readonly ID = 'workbench.contrib.dynamicWindowConfiguration';
243 >
244 > private configurationNode: IConfigurationNode | undefined;
245 > private newWindowProfile: IUserDataProfile | undefined;
246 >
247 > constructor(
248 @IUserDataProfilesService private readonly userDataProfilesService: IUserDataProfilesService,
249 @IConfigurationService private readonly configurationService: IConfigurationService,
263 this._register(this.userDataProfilesService.onDidChangeProfiles(() => this.checkAndResetNewWindowProfileConfig()));
264 }
266 > private registerNewWindowProfileConfiguration(): void {
267 const registry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
268 const configurationNode: IConfigurationNode = {
286 this.configurationNode = configurationNode;
287 }
289 > private setNewWindowProfile(): void {
290 const newWindowProfileName = this.configurationService.getValue(CONFIG_NEW_WINDOW_PROFILE);
291 this.newWindowProfile = newWindowProfileName ? this.userDataProfilesService.profiles.find(profile => profile.name === newWindowProfileName) : undefined;
292 }
294 > private checkAndResetNewWindowProfileConfig(): void {
295 const newWindowProfileName = this.configurationService.getValue(CONFIG_NEW_WINDOW_PROFILE);
296 if (!newWindowProfileName) {
303 this.configurationService.updateValue(CONFIG_NEW_WINDOW_PROFILE, profile?.name);
304 }