File tree Expand file tree Collapse file tree 6 files changed +25
-64
lines changed Expand file tree Collapse file tree 6 files changed +25
-64
lines changed Original file line number Diff line number Diff line change 158
158
"configuration" : {
159
159
"title" : " Ruby LSP" ,
160
160
"properties" : {
161
- "rubyLsp.enableExperimentalFeatures" : {
162
- "description" : " Enable experimental and under development features" ,
163
- "type" : " boolean" ,
164
- "default" : false
165
- },
166
161
"rubyLsp.enabledFeatures" : {
167
162
"description" : " List of enabled LSP features" ,
168
163
"type" : " object" ,
Original file line number Diff line number Diff line change @@ -218,9 +218,6 @@ function collectClientOptions(
218
218
errorHandler : new ClientErrorHandler ( workspaceFolder , telemetry ) ,
219
219
initializationOptions : {
220
220
enabledFeatures,
221
- experimentalFeaturesEnabled : configuration . get (
222
- "enableExperimentalFeatures" ,
223
- ) ,
224
221
featuresConfiguration : configuration . get ( "featuresConfiguration" ) ,
225
222
formatter : configuration . get ( "formatter" ) ,
226
223
linters : configuration . get ( "linters" ) ,
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ export async function activate(context: vscode.ExtensionContext) {
25
25
return ;
26
26
}
27
27
28
+ await migrateExperimentalFeaturesSetting ( ) ;
29
+
28
30
const logger = await createLogger ( context ) ;
29
31
context . subscriptions . push ( logger ) ;
30
32
@@ -36,6 +38,21 @@ export async function deactivate(): Promise<void> {
36
38
await extension . deactivate ( ) ;
37
39
}
38
40
41
+ // Remove after ~2 months. This code migrates the old experimental features setting to the new feature flag rollout
42
+ // setting
43
+ async function migrateExperimentalFeaturesSetting ( ) {
44
+ const config = vscode . workspace . getConfiguration ( "rubyLsp" ) ;
45
+ const experimentalFeatures = config . get ( "enableExperimentalFeatures" ) ;
46
+
47
+ if ( experimentalFeatures ) {
48
+ // Remove the old setting
49
+ await config . update ( "enableExperimentalFeatures" , undefined , true ) ;
50
+
51
+ // Add the new one
52
+ await config . update ( "featureFlags" , { all : true } , true ) ;
53
+ }
54
+ }
55
+
39
56
async function createLogger ( context : vscode . ExtensionContext ) {
40
57
let sender ;
41
58
Original file line number Diff line number Diff line change @@ -119,29 +119,6 @@ export class ServerStatus extends StatusItem {
119
119
}
120
120
}
121
121
122
- export class ExperimentalFeaturesStatus extends StatusItem {
123
- constructor ( ) {
124
- super ( "experimentalFeatures" ) ;
125
-
126
- const experimentalFeaturesEnabled =
127
- vscode . workspace
128
- . getConfiguration ( "rubyLsp" )
129
- . get ( "enableExperimentalFeatures" ) === true ;
130
- const message = experimentalFeaturesEnabled
131
- ? "Experimental features enabled"
132
- : "Experimental features disabled" ;
133
-
134
- this . item . name = "Ruby LSP Experimental Features" ;
135
- this . item . text = message ;
136
- this . item . command = {
137
- title : experimentalFeaturesEnabled ? "Disable" : "Enable" ,
138
- command : Command . ToggleExperimentalFeatures ,
139
- } ;
140
- }
141
-
142
- refresh ( _workspace : WorkspaceInterface ) : void { }
143
- }
144
-
145
122
export class FeaturesStatus extends StatusItem {
146
123
constructor ( ) {
147
124
super ( "features" ) ;
@@ -225,7 +202,6 @@ export class StatusItems {
225
202
this . items = [
226
203
new RubyVersionStatus ( ) ,
227
204
new ServerStatus ( ) ,
228
- new ExperimentalFeaturesStatus ( ) ,
229
205
new FeaturesStatus ( ) ,
230
206
new FormatterStatus ( ) ,
231
207
new AddonsStatus ( ) ,
Original file line number Diff line number Diff line change @@ -33,6 +33,12 @@ suite("Common", () => {
33
33
} ) ;
34
34
35
35
test ( "maintains enabled state when increasing rollout percentage" , ( ) => {
36
+ const stub = sandbox . stub ( vscode . workspace , "getConfiguration" ) . returns ( {
37
+ get : ( ) => {
38
+ return { all : undefined } ;
39
+ } ,
40
+ } as any ) ;
41
+
36
42
// For the fake machine of 42 in base 16 and the name `fakeFeature`, the feature flag activation percetange is
37
43
// 0.357. For every percetange below that, the feature should appear as disabled
38
44
[ 0.25 , 0.3 , 0.35 ] . forEach ( ( percentage ) => {
@@ -45,6 +51,8 @@ suite("Common", () => {
45
51
( FEATURE_FLAGS as any ) . fakeFeature = percentage ;
46
52
assert . strictEqual ( featureEnabled ( "fakeFeature" as any ) , true ) ;
47
53
} ) ;
54
+
55
+ stub . restore ( ) ;
48
56
} ) ;
49
57
50
58
test ( "returns false if user opted out of specific feature" , ( ) => {
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ import { Ruby } from "../../ruby";
9
9
import {
10
10
RubyVersionStatus ,
11
11
ServerStatus ,
12
- ExperimentalFeaturesStatus ,
13
12
StatusItem ,
14
13
FeaturesStatus ,
15
14
FormatterStatus ,
@@ -21,7 +20,6 @@ suite("StatusItems", () => {
21
20
let ruby : Ruby ;
22
21
let status : StatusItem ;
23
22
let workspace : WorkspaceInterface ;
24
- let formatter : string ;
25
23
26
24
afterEach ( ( ) => {
27
25
status . dispose ( ) ;
@@ -145,36 +143,6 @@ suite("StatusItems", () => {
145
143
} ) ;
146
144
} ) ;
147
145
148
- suite ( "ExperimentalFeaturesStatus" , ( ) => {
149
- beforeEach ( ( ) => {
150
- ruby = { } as Ruby ;
151
- workspace = {
152
- ruby,
153
- lspClient : {
154
- addons : [ ] ,
155
- state : State . Running ,
156
- formatter,
157
- serverVersion : "1.0.0" ,
158
- sendRequest : < T > ( ) => Promise . resolve ( [ ] as T ) ,
159
- degraded : false ,
160
- } ,
161
- error : false ,
162
- } ;
163
- status = new ExperimentalFeaturesStatus ( ) ;
164
- status . refresh ( workspace ) ;
165
- } ) ;
166
-
167
- test ( "Status is initialized with the right values" , ( ) => {
168
- assert . match ( status . item . text , / E x p e r i m e n t a l f e a t u r e s ( d i s | e n ) a b l e d / ) ;
169
- assert . strictEqual ( status . item . name , "Ruby LSP Experimental Features" ) ;
170
- assert . match ( status . item . command ?. title ! , / E n a b l e | D i s a b l e / ) ;
171
- assert . strictEqual (
172
- status . item . command ! . command ,
173
- Command . ToggleExperimentalFeatures ,
174
- ) ;
175
- } ) ;
176
- } ) ;
177
-
178
146
suite ( "FeaturesStatus" , ( ) => {
179
147
beforeEach ( ( ) => {
180
148
ruby = { } as Ruby ;
You can’t perform that action at this time.
0 commit comments