Skip to content

Commit

Permalink
Remove version manager setting migration code (#2600)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistock authored Sep 23, 2024
1 parent a29808c commit dd57908
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { LOG_CHANNEL } from "./common";
let extension: RubyLsp;

export async function activate(context: vscode.ExtensionContext) {
await migrateManagerConfigurations();

if (!vscode.workspace.workspaceFolders) {
// We currently don't support usage without any workspace folders opened. Here we warn the user, point to the issue
// and offer to open a folder instead
Expand Down Expand Up @@ -38,38 +36,6 @@ export async function deactivate(): Promise<void> {
await extension.deactivate();
}

type InspectKeys =
| "globalValue"
| "workspaceValue"
| "workspaceFolderValue"
| "globalLanguageValue"
| "workspaceLanguageValue"
| "workspaceFolderLanguageValue";
// Function to migrate the old version manager configuration to the new format. Remove this after a few months
async function migrateManagerConfigurations() {
const configuration = vscode.workspace.getConfiguration("rubyLsp");
const currentManagerSettings =
configuration.inspect<string>("rubyVersionManager")!;
let identifier: string | undefined;

const targetMap: Record<InspectKeys, vscode.ConfigurationTarget> = {
globalValue: vscode.ConfigurationTarget.Global,
globalLanguageValue: vscode.ConfigurationTarget.Global,
workspaceFolderLanguageValue: vscode.ConfigurationTarget.WorkspaceFolder,
workspaceFolderValue: vscode.ConfigurationTarget.WorkspaceFolder,
workspaceLanguageValue: vscode.ConfigurationTarget.Workspace,
workspaceValue: vscode.ConfigurationTarget.Workspace,
};

for (const [key, target] of Object.entries(targetMap)) {
identifier = currentManagerSettings[key as InspectKeys];

if (identifier && typeof identifier === "string") {
await configuration.update("rubyVersionManager", { identifier }, target);
}
}
}

async function createLogger(context: vscode.ExtensionContext) {
let sender;

Expand Down

0 comments on commit dd57908

Please sign in to comment.