configurationResolverExpression.ts ×15

Frontier kind: Joint frontier

unlabeled · c_f3c6df96032f

1 test · 42305 LOC · 197 files · introduces 1 test · 106 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
21 ranges106 lines · 3 files
Tests
1 test

Contains — complete concept membership

All code (extent)
3829 ranges42305 lines · 197 files · Browse complete extent
All tests (intent)
1 testBrowse 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.

1 test introduced at this concept.

Introduced code

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

3 files ranked by introduced lines: 106 introduced LOC across 21 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/services/configurationResolver/common/configurationResolverExpression.ts 85 introduced LOC · 15 ranges

Open complete file

118
119 private parseVariable(str: string, start: number): { replacement: Replacement; end: number } | undefined {
120 > if (str[start] !== '$' || str[start + 1] !== '{') { configurationResolverExpression.ts
121 return undefined;
122 }
124 > let end = start + 2;
125 > let braceCount = 1;
126 > while (end < str.length) {
127 > if (str[end] === '{') {
128 braceCount++;
129 > } else if (str[end] === '}') { configurationResolverExpression.ts
130 > braceCount--;
131 > if (braceCount === 0) {
132 > break;
133 > }
134 > }
135 > end++;
136 > }
137 >
138 > if (braceCount !== 0) {
139 return undefined;
140 }
142 > const id = str.slice(start, end + 1);
143 > const inner = str.substring(start + 2, end);
144 > const colonIdx = inner.indexOf(':');
145 > if (colonIdx === -1) {
146 > return { replacement: { id, name: inner, inner }, end };
147 > }
148 >
149 > return {
150 > replacement: {
151 > id,
152 > inner,
153 > name: inner.slice(0, colonIdx),
154 > arg: inner.slice(colonIdx + 1)
155 > },
156 > end
157 > };
158 > }
159
160 private parseObject(obj: any): void {
193 break;
194 }
195 > const parsed = this.parseVariable(value, match); configurationResolverExpression.ts
196 > if (parsed) {
197 > pos = parsed.end + 1;
198 > if (replacementPath?.includes(parsed.replacement.id)) {
199 continue;
200 }
202 > const locations = this.locations.get(parsed.replacement.id) || { locations: [], replacement: parsed.replacement };
203 > const newLocation: PropertyLocation = { object, propertyName, replaceKeyName };
204 > locations.locations.push(newLocation);
205 > this.locations.set(parsed.replacement.id, locations);
206 >
207 > if (locations.resolved) {
208 this._resolveAtLocation(parsed.replacement, newLocation, locations.resolved, replacementPath);
210 > this.newReplacementNotifiers.forEach(n => n(parsed.replacement));
211 > }
212 > } else {
213 pos = match + 2;
214 }
223
224 for (const location of this.locations.values()) {
225 > if (location.resolved === undefined) { configurationResolverExpression.ts
226 > newReplacements.set(location.replacement.id, location.replacement);
227 > }
228 > }
229
230 this.newReplacementNotifiers.add(notifier);
235 break;
236 }
238 > const [key, value] = next;
239 > yield value;
240 > newReplacements.delete(key);
241 > }
242
243 this.newReplacementNotifiers.delete(notifier);
257 return;
258 }
260 > location.resolved = data;
261 >
262 > if (data.value !== undefined) {
263 > for (const l of location.locations || Iterable.empty()) {
264 > this._resolveAtLocation(replacement, l, data);
265 > }
266 > }
267 }
268
269 private _resolveAtLocation(replacement: Replacement, { replaceKeyName, propertyName, object }: PropertyLocation, data: IResolvedValue, path: string[] = []) {
270 > if (data.value === undefined) { configurationResolverExpression.ts
271 return;
272 }
274 > // avoid recursive resolution, e.g. ${env:FOO} -> ${env:BAR}=${env:FOO}
275 > path.push(replacement.id);
276 >
277 > // note: in nested `this.parseString`, parse only the new substring for any replacements, don't reparse the whole string
278 > if (replaceKeyName && typeof propertyName === 'string') {
279 const value = object[propertyName];
280 const newKey = propertyName.replaceAll(replacement.id, data.value);
283 this._renameKeyInLocations(object, propertyName, newKey);
284 this.parseString(object, newKey, data.value, true, path);
286 > object[propertyName] = object[propertyName].replaceAll(replacement.id, data.value);
287 > this.parseString(object, propertyName, data.value, false, path);
288 > }
289 >
290 > path.pop();
291 > }
292
293 private _renameKeyInLocations(obj: object, oldKey: string, newKey: string) {
src/vs/workbench/contrib/mcp/common/mcpRegistry.ts 17 introduced LOC · 5 ranges

Open complete file

178
179 public async clearSavedInputs(scope: StorageScope, inputId?: string) {
180 > const storage = this._getInputStorage(scope); mcpRegistry.ts
181 > if (inputId) {
182 await storage.clear(inputId);
183 > } else { mcpRegistry.ts
184 > storage.clearAll();
185 > }
186 >
187 > this._onDidChangeInputs.fire();
188 > }
189
190 public async editSavedInput(inputId: string, folderData: IWorkspaceFolderData | undefined, configSection: string, target: ConfigurationTarget): Promise<void> {
437 const inputs: Record<string, IResolvedValue> = {};
438 for (const [replacement, resolved] of expr.resolved()) {
439 > if (resolved.input?.type === 'promptString' && resolved.input.password) { mcpRegistry.ts
440 secrets[replacement.id] = resolved;
441 > } else { mcpRegistry.ts
442 > inputs[replacement.id] = resolved;
443 > }
444 > }
445
446 inputStorage.setPlainText(inputs);
464 const expr = ConfigurationResolverExpression.parse(withRemoteFilled);
465 for (const replacement of expr.unresolved()) {
466 > if (previouslyStored.hasOwnProperty(replacement.id)) { mcpRegistry.ts
467 > expr.resolve(replacement, previouslyStored[replacement.id]);
468 > }
469 > }
470
471 // Check if there are still unresolved variables that would require interaction
src/vs/base/common/iterator.ts 4 introduced LOC · 1 range

Open complete file

83 export function* filter<T>(iterable: Iterable<T>, predicate: (t: T) => boolean): Iterable<T> {
84 for (const element of iterable) {
85 > if (predicate(element)) { iterator.ts
86 > yield element;
87 > }
88 > }
89 }
90