@@ -3347,15 +3347,15 @@ class BracketPairColorization extends BaseEditorOption<EditorOption.bracketPairC
3347
3347
export interface IGuidesOptions {
3348
3348
/**
3349
3349
* Enable rendering of bracket pair guides.
3350
- * Defaults to 'none' .
3350
+ * Defaults to false .
3351
3351
*/
3352
- bracketPairs ?: 'all' | 'active' | 'none ';
3352
+ bracketPairs ?: boolean | 'active' ;
3353
3353
3354
3354
/**
3355
3355
* Enable rendering of vertical bracket pair guides.
3356
3356
* Defaults to 'active'.
3357
3357
*/
3358
- bracketPairsHorizontal ?: 'all' | 'active' | 'none ';
3358
+ bracketPairsHorizontal ?: boolean | 'active' ;
3359
3359
3360
3360
/**
3361
3361
* Enable highlighting of the active bracket pair.
@@ -3387,7 +3387,7 @@ export type InternalGuidesOptions = Readonly<Required<IGuidesOptions>>;
3387
3387
class GuideOptions extends BaseEditorOption < EditorOption . guides , InternalGuidesOptions > {
3388
3388
constructor ( ) {
3389
3389
const defaults : InternalGuidesOptions = {
3390
- bracketPairs : 'none' ,
3390
+ bracketPairs : false ,
3391
3391
bracketPairsHorizontal : 'active' ,
3392
3392
highlightActiveBracketPair : true ,
3393
3393
@@ -3399,14 +3399,14 @@ class GuideOptions extends BaseEditorOption<EditorOption.guides, InternalGuidesO
3399
3399
EditorOption . guides , 'guides' , defaults ,
3400
3400
{
3401
3401
'editor.guides.bracketPairs' : {
3402
- type : ' string',
3403
- enum : [ 'all' , 'active' , 'none' ] ,
3402
+ type : [ 'boolean' , ' string'] ,
3403
+ enum : [ true , 'active' , false ] ,
3404
3404
default : defaults . bracketPairs ,
3405
3405
description : nls . localize ( 'editor.guides.bracketPairs' , "Controls whether bracket pair guides are enabled or not." )
3406
3406
} ,
3407
3407
'editor.guides.bracketPairsHorizontal' : {
3408
- type : ' string',
3409
- enum : [ 'all' , 'active' , 'none' ] ,
3408
+ type : [ 'boolean' , ' string'] ,
3409
+ enum : [ true , 'active' , false ] ,
3410
3410
default : defaults . bracketPairsHorizontal ,
3411
3411
description : nls . localize ( 'editor.guides.bracketPairsHorizontal' , "Controls whether horizontal bracket pair guides are enabled or not." )
3412
3412
} ,
@@ -3435,8 +3435,8 @@ class GuideOptions extends BaseEditorOption<EditorOption.guides, InternalGuidesO
3435
3435
}
3436
3436
const input = _input as IGuidesOptions ;
3437
3437
return {
3438
- bracketPairs : stringSet ( input . bracketPairs , this . defaultValue . bracketPairs , [ 'all' , 'active' , 'none ' ] ) ,
3439
- bracketPairsHorizontal : stringSet ( input . bracketPairsHorizontal , this . defaultValue . bracketPairsHorizontal , [ 'all' , 'active' , 'none ' ] ) ,
3438
+ bracketPairs : primitiveSet ( input . bracketPairs , this . defaultValue . bracketPairs , [ true , false , 'active ' ] ) ,
3439
+ bracketPairsHorizontal : primitiveSet ( input . bracketPairsHorizontal , this . defaultValue . bracketPairsHorizontal , [ true , false , 'active ' ] ) ,
3440
3440
highlightActiveBracketPair : boolean ( input . highlightActiveBracketPair , this . defaultValue . highlightActiveBracketPair ) ,
3441
3441
3442
3442
indentation : boolean ( input . indentation , this . defaultValue . indentation ) ,
@@ -3445,6 +3445,14 @@ class GuideOptions extends BaseEditorOption<EditorOption.guides, InternalGuidesO
3445
3445
}
3446
3446
}
3447
3447
3448
+ function primitiveSet < T extends string | boolean > ( value : unknown , defaultValue : T , allowedValues : T [ ] ) : T {
3449
+ const idx = allowedValues . indexOf ( value as any ) ;
3450
+ if ( idx === - 1 ) {
3451
+ return defaultValue ;
3452
+ }
3453
+ return allowedValues [ idx ] ;
3454
+ }
3455
+
3448
3456
//#endregion
3449
3457
3450
3458
//#region suggest
0 commit comments