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 ranges 48 lines · 1 files
Tests
1 test
Contains — complete concept membership
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.
Focus concept
Ancestors (broader)
Descendants (narrower)
Introduced files
Introduced tests
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.
JavaScript is disabled; use the native relationship evidence on this page to explore the same evidence.
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 ) {
318
>
if ( expr . type !== TokenType . RegexStr ) {
319
throw this . _errExpectedButGot ( `REGEX` , expr );
320
}
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' :
441
case 'false' :
443
default :
444
return ContextKeyExpr . equals ( key , right );
455
switch ( right ) {
456
case 'true' :
458
case 'false' :
460
default :
461
return ContextKeyExpr . notEquals ( key , right );
507
return token . lexeme ;
508
case TokenType.True :
510
>
return 'true' ;
511
case TokenType.False :
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 {
705
>
}
706
707
public serialize () : string {
743
744
public evaluate ( context : IContext ) : boolean {
746
>
}
747
748
public serialize () : string {
1091
1092
public evaluate ( context : IContext ) : boolean {
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 {
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 {
1622
}
1623
}
1625
}
1626
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 ;
1858
1859
private static _normalizeArr ( arr : ReadonlyArray < ContextKeyExpression | null | undefined >, negated : ContextKeyExpression | null , extraRedundantCheck : boolean ) : ContextKeyExpression | undefined {
1911
1912
if ( expr . length === 1 ) {
1914
>
}
1915
1916
// resolve true OR expressions