yaml.ts ×11

Frontier kind: Code frontier

unlabeled · c_9a1989da1760

199 tests · 3906 LOC · 19 files · introduces 0 tests · 52 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges52 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
617 ranges3906 lines · 19 files · Browse complete extent
All tests (intent)
199 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: 52 introduced LOC across 11 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/base/common/yaml.ts 52 introduced LOC · 11 ranges

Open complete file

359 this.pos++;
360 if (this.flowDepth === 0) {
361 > this.seenBlockColon = true; yaml.ts
362 > }
363 } else if (ch === ':' && this.flowDepth > 0 && this.lastTokenIsJsonLike()) {
364 // In flow context, ':' immediately following a JSON-like node (quoted scalar,
1253
1254 private parseBlockMapping(baseIndent: number, inlineFirstEntry = false): YamlMapNode {
1255 > const startOffset = this.currentToken().startOffset; yaml.ts
1256 > const properties: { key: YamlScalarNode; value: YamlNode }[] = [];
1257 > const seenKeys = new Set<string>();
1258 >
1259 > // When called after a sequence dash, the first key is already at the current position
1260 > if (inlineFirstEntry) {
1261 const firstEntry = this.parseMappingEntry(baseIndent);
1262 if (firstEntry) {
1265 }
1266 }
1267 > yaml.ts
1268 > while (this.currentToken().type !== TokenType.EOF) {
1269 > this.skipNewlinesAndComments();
1270 > if (this.currentToken().type === TokenType.EOF) { break; }
1271 >
1272 > const indent = this.currentIndent();
1273 > if (indent < baseIndent) { break; }
1274 > if (indent !== baseIndent) {
1275 if (indent > baseIndent) {
1276 this.emitError(
1284 }
1285 }
1286 > if (!this.looksLikeMapping()) { break; } yaml.ts
1287 >
1288 > const entry = this.parseMappingEntry(baseIndent);
1289 > if (!entry) { break; }
1290 >
1291 > if (!this.options.allowDuplicateKeys && seenKeys.has(entry.key.value)) {
1292 this.emitError(
1293 localize('duplicateKey', 'Duplicate key: "{0}"', entry.key.value),
1297 );
1298 }
1299 > seenKeys.add(entry.key.value); yaml.ts
1300 > properties.push(entry);
1301 > }
1302 >
1303 > const endOffset = properties.length > 0 ? properties[properties.length - 1].value.endOffset : startOffset;
1304 > return { type: 'map', properties, style: 'block', startOffset, endOffset };
1305 > }
1306
1307 private parseMappingEntry(baseIndent: number): { key: YamlScalarNode; value: YamlNode } | undefined {
1308 > // Skip indent yaml.ts
1309 > if (this.currentToken().type === TokenType.Indent) {
1310 this.advance();
1311 }
1312 > yaml.ts
1313 > // Parse key
1314 > const keyToken = this.expect(TokenType.Scalar);
1315 > const key = this.scalarFromToken(keyToken);
1316 >
1317 > // Expect colon
1318 > const colon = this.expect(TokenType.Colon);
1319 > if (colon.type !== TokenType.Colon) {
1320 this.emitError(localize('expectedColon', 'Expected ":"'), colon.startOffset, colon.endOffset, 'expected-colon');
1321 return undefined;
1322 }
1323 > yaml.ts
1324 > // Parse value: could be on same line or next line (indented)
1325 > const value = this.parseMappingValue(baseIndent, colon);
1326 >
1327 > return { key, value };
1328 > }
1329
1330 private parseMappingValue(baseIndent: number, colonToken: Token): YamlNode {
1331 > // Check if there's a value on the same line after the colon yaml.ts
1332 > const next = this.currentToken();
1333 >
1334 > // Same-line flow collections
1335 > if (next.type === TokenType.FlowMapStart) { return this.parseFlowMap(); }
1336 if (next.type === TokenType.FlowSeqStart) { return this.parseFlowSeq(); }
1337
1364 // Special case: a sequence at the same indent as the mapping key is allowed
1365 // as the mapping value (e.g., "foo:\n- 42")
1366 > if (nextIndent === baseIndent && this.peekPastIndent().type === TokenType.Dash) { yaml.ts
1367 return this.parseValue(baseIndent) ?? this.makeEmptyScalar(colonToken.endOffset);
1368 }
1376 // Parse the nested value
1377 return this.parseValue(baseIndent) ?? this.makeEmptyScalar(colonToken.endOffset);
1378 > } yaml.ts
1379
1380 // -- Block sequence --------------------------------------------------