contextkey.ts ×19

Frontier kind: Joint frontier

unlabeled · c_5957cc291a04

1 test · 6700 LOC · 29 files · introduces 1 test · 48 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
19 ranges48 lines · 1 files
Tests
1 test

Contains — complete concept membership

All code (extent)
1238 ranges6700 lines · 29 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.

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

src/vs/platform/contextkey/common/contextkey.ts 48 introduced LOC · 19 ranges

Open complete file

315
316 if (!this._config.regexParsingWithErrorRecovery) {
317 > this._advance(); contextkey.ts
318 > if (expr.type !== TokenType.RegexStr) {
319 throw this._errExpectedButGot(`REGEX`, expr);
320 }
321 > const regexLexeme = expr.lexeme; contextkey.ts
322 > const closingSlashIndex = regexLexeme.lastIndexOf('/');
323 > const flags = closingSlashIndex === regexLexeme.length - 1 ? undefined : this._removeFlagsGY(regexLexeme.substring(closingSlashIndex + 1));
324 > let regexp: RegExp | null;
325 > try {
326 > regexp = new RegExp(regexLexeme.substring(1, closingSlashIndex), flags);
327 > } catch (e) {
328 throw this._errExpectedButGot(`REGEX`, expr);
329 }
330 > return ContextKeyRegexExpr.create(key, regexp); contextkey.ts
331 > }
332
333 switch (expr.type) {
438 switch (right) {
439 case 'true':
440 > return ContextKeyExpr.has(key); contextkey.ts
441 case 'false':
442 > return ContextKeyExpr.not(key); contextkey.ts
443 default:
444 return ContextKeyExpr.equals(key, right);
455 switch (right) {
456 case 'true':
457 > return ContextKeyExpr.not(key); contextkey.ts
458 case 'false':
459 > return ContextKeyExpr.has(key); contextkey.ts
460 default:
461 return ContextKeyExpr.notEquals(key, right);
507 return token.lexeme;
508 case TokenType.True:
509 > this._advance(); contextkey.ts
510 > return 'true';
511 case TokenType.False:
512 > this._advance(); contextkey.ts
513 > return 'false';
514 case TokenType.In: // we support `in` as a value, e.g., "when": "languageId == in" - exists in existing extensions
515 this._advance();
702
703 public evaluate(context: IContext): boolean {
704 > return false; contextkey.ts
705 > }
706
707 public serialize(): string {
743
744 public evaluate(context: IContext): boolean {
745 > return true; contextkey.ts
746 > }
747
748 public serialize(): string {
1091
1092 public evaluate(context: IContext): boolean {
1093 > // Intentional != contextkey.ts
1094 > // eslint-disable-next-line eqeqeq
1095 > return (context.getValue(this.key) != this.value);
1096 > }
1097
1098 public serialize(): string {
1157
1158 public evaluate(context: IContext): boolean {
1159 > return (!context.getValue(this.key)); contextkey.ts
1160 > }
1161
1162 public serialize(): string {
1482
1483 public evaluate(context: IContext): boolean {
1484 > const value = context.getValue<any>(this.key); contextkey.ts
1485 > return this.regexp ? this.regexp.test(value) : false;
1486 > }
1487
1488 public serialize(): string {
1650
1651 public evaluate(context: IContext): boolean {
1652 > for (let i = 0, len = this.expr.length; i < len; i++) { contextkey.ts
1653 > if (!this.expr[i].evaluate(context)) {
1654 > return false;
1655 > }
1656 > }
1657 > return true;
1658 > }
1659
1660 private static _normalizeArr(arr: ReadonlyArray<ContextKeyExpression | null | undefined>, negated: ContextKeyExpression | null, extraRedundantCheck: boolean): ContextKeyExpression | undefined {
1849
1850 public evaluate(context: IContext): boolean {
1851 > for (let i = 0, len = this.expr.length; i < len; i++) { contextkey.ts
1852 > if (this.expr[i].evaluate(context)) {
1853 > return true;
1854 > }
1855 > }
1856 return false;
1857 > } contextkey.ts
1858
1859 private static _normalizeArr(arr: ReadonlyArray<ContextKeyExpression | null | undefined>, negated: ContextKeyExpression | null, extraRedundantCheck: boolean): ContextKeyExpression | undefined {
1911
1912 if (expr.length === 1) {
1913 > return expr[0]; contextkey.ts
1914 > }
1915
1916 // resolve true OR expressions