@@ -2454,17 +2454,10 @@ export class EditorLayoutInfoComputer extends ComputedEditorOption<EditorOption.
2454
2454
const scrollbarArrowSize = scrollbar . arrowSize ;
2455
2455
const horizontalScrollbarHeight = scrollbar . horizontalScrollbarSize ;
2456
2456
2457
- const rawLineDecorationsWidth = options . get ( EditorOption . lineDecorationsWidth ) ;
2458
2457
const folding = options . get ( EditorOption . folding ) ;
2459
2458
const showFoldingDecoration = options . get ( EditorOption . showFoldingControls ) !== 'never' ;
2460
2459
2461
- let lineDecorationsWidth : number ;
2462
- if ( typeof rawLineDecorationsWidth === 'string' && / ^ \d + ( \. \d + ) ? c h $ / . test ( rawLineDecorationsWidth ) ) {
2463
- const multiple = parseFloat ( rawLineDecorationsWidth . substr ( 0 , rawLineDecorationsWidth . length - 2 ) ) ;
2464
- lineDecorationsWidth = EditorIntOption . clampedInt ( multiple * typicalHalfwidthCharacterWidth , 0 , 0 , 1000 ) ;
2465
- } else {
2466
- lineDecorationsWidth = EditorIntOption . clampedInt ( rawLineDecorationsWidth , 0 , 0 , 1000 ) ;
2467
- }
2460
+ let lineDecorationsWidth = options . get ( EditorOption . lineDecorationsWidth ) ;
2468
2461
if ( folding && showFoldingDecoration ) {
2469
2462
lineDecorationsWidth += 16 ;
2470
2463
}
@@ -2808,6 +2801,35 @@ class EditorInlayHints extends BaseEditorOption<EditorOption.inlayHints, IEditor
2808
2801
2809
2802
//#endregion
2810
2803
2804
+ //#region lineDecorationsWidth
2805
+
2806
+ class EditorLineDecorationsWidth extends BaseEditorOption < EditorOption . lineDecorationsWidth , number | string , number > {
2807
+
2808
+ constructor ( ) {
2809
+ super ( EditorOption . lineDecorationsWidth , 'lineDecorationsWidth' , 10 ) ;
2810
+ }
2811
+
2812
+ public validate ( input : any ) : number {
2813
+ if ( typeof input === 'string' && / ^ \d + ( \. \d + ) ? c h $ / . test ( input ) ) {
2814
+ const multiple = parseFloat ( input . substring ( 0 , input . length - 2 ) ) ;
2815
+ return - multiple ; // negative numbers signal a multiple
2816
+ } else {
2817
+ return EditorIntOption . clampedInt ( input , this . defaultValue , 0 , 1000 ) ;
2818
+ }
2819
+ }
2820
+
2821
+ public override compute ( env : IEnvironmentalOptions , options : IComputedEditorOptions , value : number ) : number {
2822
+ if ( value < 0 ) {
2823
+ // negative numbers signal a multiple
2824
+ return EditorIntOption . clampedInt ( - value * env . fontInfo . typicalHalfwidthCharacterWidth , this . defaultValue , 0 , 1000 ) ;
2825
+ } else {
2826
+ return value ;
2827
+ }
2828
+ }
2829
+ }
2830
+
2831
+ //#endregion
2832
+
2811
2833
//#region lineHeight
2812
2834
2813
2835
class EditorLineHeight extends EditorFloatOption < EditorOption . lineHeight > {
@@ -5151,7 +5173,7 @@ export const EditorOptions = {
5151
5173
{ description : nls . localize ( 'letterSpacing' , "Controls the letter spacing in pixels." ) }
5152
5174
) ) ,
5153
5175
lightbulb : register ( new EditorLightbulb ( ) ) ,
5154
- lineDecorationsWidth : register ( new SimpleEditorOption ( EditorOption . lineDecorationsWidth , 'lineDecorationsWidth' , 10 as number | string ) ) ,
5176
+ lineDecorationsWidth : register ( new EditorLineDecorationsWidth ( ) ) ,
5155
5177
lineHeight : register ( new EditorLineHeight ( ) ) ,
5156
5178
lineNumbers : register ( new EditorRenderLineNumbersOption ( ) ) ,
5157
5179
lineNumbersMinChars : register ( new EditorIntOption (
0 commit comments