@@ -13,6 +13,7 @@ interface State {
1313 useTabs ?: boolean ;
1414 trailingComma ?: TrailingComma ;
1515 requirePragma ?: boolean ;
16+ experimentalOperatorPosition ?: ExperimentalOperatorPosition ;
1617 code ?: string ;
1718}
1819
@@ -22,6 +23,11 @@ enum TrailingComma {
2223 None = "none"
2324}
2425
26+ enum ExperimentalOperatorPosition {
27+ START = 'start' ,
28+ END = 'end'
29+ }
30+
2531const codeSample = `public interface MyInterface {
2632 String foo();
2733 int[] bar();
@@ -69,6 +75,9 @@ function Inner() {
6975 const [ requirePragma , setRequirePragma ] = useState (
7076 initialState . requirePragma ?? false
7177 ) ;
78+ const [ experimentalOperatorPosition , setExperimentalOperatorPosition ] = useState (
79+ initialState . experimentalOperatorPosition ?? ExperimentalOperatorPosition . END
80+ ) ;
7281 const [ code , setCode ] = useState ( initialState . code ?? codeSample ) ;
7382 const [ formattedCode , setFormattedCode ] = useState ( "" ) ;
7483
@@ -84,6 +93,7 @@ function Inner() {
8493 useTabs,
8594 trailingComma,
8695 requirePragma,
96+ experimentalOperatorPosition,
8797 code
8898 } ) ;
8999 history . replace ( { ...location , hash } ) ;
@@ -97,6 +107,7 @@ function Inner() {
97107 tabWidth,
98108 useTabs,
99109 trailingComma,
110+ experimentalOperatorPosition,
100111 requirePragma
101112 } )
102113 . then ( setFormattedCode )
@@ -150,6 +161,19 @@ function Inner() {
150161 ) ) }
151162 </ select >
152163 </ label >
164+ < label title = "Where to print operators when binary expressions wrap lines." >
165+ --experimental-operator-position{ " " }
166+ < select
167+ value = { experimentalOperatorPosition }
168+ onChange = { event =>
169+ setExperimentalOperatorPosition ( event . target . value as ExperimentalOperatorPosition )
170+ }
171+ >
172+ { Object . values ( ExperimentalOperatorPosition ) . map ( option => (
173+ < option key = { option } > { option } </ option >
174+ ) ) }
175+ </ select >
176+ </ label >
153177 </ details >
154178 < details open >
155179 < summary > Special</ summary >
0 commit comments