@@ -1487,6 +1487,43 @@ class EditorFontSize extends SimpleEditorOption<EditorOption.fontSize, number> {
14871487
14881488//#endregion
14891489
1490+ //#region fontWeight
1491+
1492+ class EditorFontWeight extends BaseEditorOption < EditorOption . fontWeight , string > {
1493+ private static ENUM_VALUES = [ 'normal' , 'bold' , '100' , '200' , '300' , '400' , '500' , '600' , '700' , '800' , '900' ] ;
1494+ private static MINIMUM_VALUE = 1 ;
1495+ private static MAXIMUM_VALUE = 1000 ;
1496+
1497+ constructor ( ) {
1498+ super (
1499+ EditorOption . fontWeight , 'fontWeight' , EDITOR_FONT_DEFAULTS . fontWeight ,
1500+ {
1501+ anyOf : [
1502+ {
1503+ type : 'number' ,
1504+ minimum : EditorFontWeight . MINIMUM_VALUE ,
1505+ maximum : EditorFontWeight . MAXIMUM_VALUE
1506+ } ,
1507+ {
1508+ enum : EditorFontWeight . ENUM_VALUES
1509+ }
1510+ ] ,
1511+ default : EDITOR_FONT_DEFAULTS . fontWeight ,
1512+ description : nls . localize ( 'fontWeight' , "Controls the font weight." )
1513+ }
1514+ ) ;
1515+ }
1516+
1517+ public validate ( input : any ) : string {
1518+ if ( typeof input === 'number' ) {
1519+ return EditorFontWeight . MINIMUM_VALUE <= input && input <= EditorFontWeight . MAXIMUM_VALUE ? String ( input ) : EDITOR_FONT_DEFAULTS . fontWeight ;
1520+ }
1521+ return EditorStringEnumOption . stringSet < string > ( input , EDITOR_FONT_DEFAULTS . fontWeight , EditorFontWeight . ENUM_VALUES ) ;
1522+ }
1523+ }
1524+
1525+ //#endregion
1526+
14901527//#region gotoLocation
14911528
14921529export type GoToLocationValues = 'peek' | 'gotoAndPeek' | 'goto' ;
@@ -1820,7 +1857,7 @@ export interface EditorLayoutInfoComputerEnv {
18201857 readonly memory : ComputeOptionsMemory | null ;
18211858 readonly outerWidth : number ;
18221859 readonly outerHeight : number ;
1823- readonly isDominatedByLongLines : boolean
1860+ readonly isDominatedByLongLines : boolean ;
18241861 readonly lineHeight : number ;
18251862 readonly viewLineCount : number ;
18261863 readonly lineNumbersDigitCount : number ;
@@ -1835,7 +1872,7 @@ export interface EditorLayoutInfoComputerEnv {
18351872export interface IEditorLayoutComputerInput {
18361873 readonly outerWidth : number ;
18371874 readonly outerHeight : number ;
1838- readonly isDominatedByLongLines : boolean
1875+ readonly isDominatedByLongLines : boolean ;
18391876 readonly lineHeight : number ;
18401877 readonly lineNumbersDigitCount : number ;
18411878 readonly typicalHalfwidthCharacterWidth : number ;
@@ -3098,7 +3135,7 @@ export interface ISuggestOptions {
30983135 * Controls the visibility of the status bar at the bottom of the suggest widget.
30993136 */
31003137 visible ?: boolean ;
3101- }
3138+ } ;
31023139}
31033140
31043141export type InternalSuggestOptions = Readonly < Required < ISuggestOptions > > ;
@@ -3863,13 +3900,7 @@ export const EditorOptions = {
38633900 fontInfo : register ( new EditorFontInfo ( ) ) ,
38643901 fontLigatures2 : register ( new EditorFontLigatures ( ) ) ,
38653902 fontSize : register ( new EditorFontSize ( ) ) ,
3866- fontWeight : register ( new EditorStringOption (
3867- EditorOption . fontWeight , 'fontWeight' , EDITOR_FONT_DEFAULTS . fontWeight ,
3868- {
3869- enum : [ 'normal' , 'bold' , '100' , '200' , '300' , '400' , '500' , '600' , '700' , '800' , '900' ] ,
3870- description : nls . localize ( 'fontWeight' , "Controls the font weight." )
3871- }
3872- ) ) ,
3903+ fontWeight : register ( new EditorFontWeight ( ) ) ,
38733904 formatOnPaste : register ( new EditorBooleanOption (
38743905 EditorOption . formatOnPaste , 'formatOnPaste' , false ,
38753906 { description : nls . localize ( 'formatOnPaste' , "Controls whether the editor should automatically format the pasted content. A formatter must be available and the formatter should be able to format a range in a document." ) }
0 commit comments