Skip to content

Commit 5f13ecd

Browse files
authored
Remove experimental features from extension and migrate old settings (#2830)
1 parent 7d067e5 commit 5f13ecd

File tree

6 files changed

+25
-64
lines changed

6 files changed

+25
-64
lines changed

vscode/package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,6 @@
158158
"configuration": {
159159
"title": "Ruby LSP",
160160
"properties": {
161-
"rubyLsp.enableExperimentalFeatures": {
162-
"description": "Enable experimental and under development features",
163-
"type": "boolean",
164-
"default": false
165-
},
166161
"rubyLsp.enabledFeatures": {
167162
"description": "List of enabled LSP features",
168163
"type": "object",

vscode/src/client.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,6 @@ function collectClientOptions(
218218
errorHandler: new ClientErrorHandler(workspaceFolder, telemetry),
219219
initializationOptions: {
220220
enabledFeatures,
221-
experimentalFeaturesEnabled: configuration.get(
222-
"enableExperimentalFeatures",
223-
),
224221
featuresConfiguration: configuration.get("featuresConfiguration"),
225222
formatter: configuration.get("formatter"),
226223
linters: configuration.get("linters"),

vscode/src/extension.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export async function activate(context: vscode.ExtensionContext) {
2525
return;
2626
}
2727

28+
await migrateExperimentalFeaturesSetting();
29+
2830
const logger = await createLogger(context);
2931
context.subscriptions.push(logger);
3032

@@ -36,6 +38,21 @@ export async function deactivate(): Promise<void> {
3638
await extension.deactivate();
3739
}
3840

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+
3956
async function createLogger(context: vscode.ExtensionContext) {
4057
let sender;
4158

vscode/src/status.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -119,29 +119,6 @@ export class ServerStatus extends StatusItem {
119119
}
120120
}
121121

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-
145122
export class FeaturesStatus extends StatusItem {
146123
constructor() {
147124
super("features");
@@ -225,7 +202,6 @@ export class StatusItems {
225202
this.items = [
226203
new RubyVersionStatus(),
227204
new ServerStatus(),
228-
new ExperimentalFeaturesStatus(),
229205
new FeaturesStatus(),
230206
new FormatterStatus(),
231207
new AddonsStatus(),

vscode/src/test/suite/common.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ suite("Common", () => {
3333
});
3434

3535
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+
3642
// For the fake machine of 42 in base 16 and the name `fakeFeature`, the feature flag activation percetange is
3743
// 0.357. For every percetange below that, the feature should appear as disabled
3844
[0.25, 0.3, 0.35].forEach((percentage) => {
@@ -45,6 +51,8 @@ suite("Common", () => {
4551
(FEATURE_FLAGS as any).fakeFeature = percentage;
4652
assert.strictEqual(featureEnabled("fakeFeature" as any), true);
4753
});
54+
55+
stub.restore();
4856
});
4957

5058
test("returns false if user opted out of specific feature", () => {

vscode/src/test/suite/status.test.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { Ruby } from "../../ruby";
99
import {
1010
RubyVersionStatus,
1111
ServerStatus,
12-
ExperimentalFeaturesStatus,
1312
StatusItem,
1413
FeaturesStatus,
1514
FormatterStatus,
@@ -21,7 +20,6 @@ suite("StatusItems", () => {
2120
let ruby: Ruby;
2221
let status: StatusItem;
2322
let workspace: WorkspaceInterface;
24-
let formatter: string;
2523

2624
afterEach(() => {
2725
status.dispose();
@@ -145,36 +143,6 @@ suite("StatusItems", () => {
145143
});
146144
});
147145

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, /Experimental features (dis|en)abled/);
169-
assert.strictEqual(status.item.name, "Ruby LSP Experimental Features");
170-
assert.match(status.item.command?.title!, /Enable|Disable/);
171-
assert.strictEqual(
172-
status.item.command!.command,
173-
Command.ToggleExperimentalFeatures,
174-
);
175-
});
176-
});
177-
178146
suite("FeaturesStatus", () => {
179147
beforeEach(() => {
180148
ruby = {} as Ruby;

0 commit comments

Comments
 (0)