@@ -61,6 +61,14 @@ export interface WorkspaceConfigInterface {
61
61
* @default {}
62
62
*/
63
63
flags : Record < string , string > ;
64
+
65
+ /**
66
+ * Enable formatting experiment
67
+ * `oxc.fmt.experimental`
68
+ *
69
+ * @default false
70
+ */
71
+ [ 'fmt.experimental' ] : boolean ;
64
72
}
65
73
66
74
export class WorkspaceConfig {
@@ -70,6 +78,7 @@ export class WorkspaceConfig {
70
78
private _unusedDisableDirectives : UnusedDisableDirectives = 'allow' ;
71
79
private _typeAware : boolean = false ;
72
80
private _flags : Record < string , string > = { } ;
81
+ private _formattingExperimental : boolean = false ;
73
82
74
83
constructor ( private readonly workspace : WorkspaceFolder ) {
75
84
this . refresh ( ) ;
@@ -91,6 +100,7 @@ export class WorkspaceConfig {
91
100
'allow' ;
92
101
this . _typeAware = this . configuration . get < boolean > ( 'typeAware' ) ?? false ;
93
102
this . _flags = flags ;
103
+ this . _formattingExperimental = this . configuration . get < boolean > ( 'fmt.experimental' ) ?? false ;
94
104
}
95
105
96
106
public effectsConfigChange ( event : ConfigurationChangeEvent ) : boolean {
@@ -112,6 +122,9 @@ export class WorkspaceConfig {
112
122
if ( event . affectsConfiguration ( `${ ConfigService . namespace } .flags` , this . workspace ) ) {
113
123
return true ;
114
124
}
125
+ if ( event . affectsConfiguration ( `${ ConfigService . namespace } .fmt.experimental` , this . workspace ) ) {
126
+ return true ;
127
+ }
115
128
return false ;
116
129
}
117
130
@@ -173,6 +186,15 @@ export class WorkspaceConfig {
173
186
return this . configuration . update ( 'flags' , value , ConfigurationTarget . WorkspaceFolder ) ;
174
187
}
175
188
189
+ get formattingExperimental ( ) : boolean {
190
+ return this . _formattingExperimental ;
191
+ }
192
+
193
+ updateFormattingExperimental ( value : boolean ) : PromiseLike < void > {
194
+ this . _formattingExperimental = value ;
195
+ return this . configuration . update ( 'fmt.experimental' , value , ConfigurationTarget . WorkspaceFolder ) ;
196
+ }
197
+
176
198
public toLanguageServerConfig ( ) : WorkspaceConfigInterface {
177
199
return {
178
200
run : this . runTrigger ,
@@ -181,6 +203,7 @@ export class WorkspaceConfig {
181
203
unusedDisableDirectives : this . unusedDisableDirectives ,
182
204
typeAware : this . typeAware ,
183
205
flags : this . flags ,
206
+ [ 'fmt.experimental' ] : this . formattingExperimental ,
184
207
} ;
185
208
}
186
209
}
0 commit comments