Skip to content

Commit

Permalink
Clean up settings updater
Browse files Browse the repository at this point in the history
  • Loading branch information
DaelonSuzuka committed Oct 12, 2023
1 parent a09589e commit 3048a68
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { shouldUpdateSettings, updateOldStyleSettings, updateStoredVersion } from "./settings_updater";
import debuggerContext = require("./debugger/debugger_context");
import * as fs from "fs";
import * as path from "path";
import * as vscode from "vscode";
import { attemptSettingsUpdate } from "./settings_updater";
import { GDDocumentLinkProvider } from "./document_link_provider";
import { ClientConnectionManager } from "./lsp/ClientConnectionManager";
import { ScenePreviewProvider } from "./scene_preview_provider";
Expand All @@ -21,10 +21,7 @@ let linkProvider: GDDocumentLinkProvider = null;
let scenePreviewManager: ScenePreviewProvider = null;

export function activate(context: vscode.ExtensionContext) {
if (shouldUpdateSettings(context)) {
updateOldStyleSettings();
}
updateStoredVersion(context);
attemptSettingsUpdate(context);

lspClientManager = new ClientConnectionManager(context);
linkProvider = new GDDocumentLinkProvider(context);
Expand Down
9 changes: 8 additions & 1 deletion src/settings_updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ export function updateStoredVersion(context: vscode.ExtensionContext) {
* in `context.globalState`, meaning it was either just installed,
* or updated from a version <1.4.0. Otherwise, returns `false`.
*/
export function shouldUpdateSettings(context: vscode.ExtensionContext) : boolean {
export function shouldUpdateSettings(context: vscode.ExtensionContext): boolean {
const localVersion: string | undefined = context.globalState.get("previousVersion");
return localVersion === undefined;
}

export function attemptSettingsUpdate(context: vscode.ExtensionContext) {
if (shouldUpdateSettings(context)) {
updateOldStyleSettings();
}
updateStoredVersion(context);
}

0 comments on commit 3048a68

Please sign in to comment.