From a2f096bb488a9f35e3bdc5d95b541445d86a318f Mon Sep 17 00:00:00 2001 From: Shan Khan Date: Tue, 9 Oct 2018 15:21:31 +0500 Subject: [PATCH] Improvements #628 , #629 --- package.json | 2 ++ package.nls.json | 3 ++- src/commons.ts | 3 +-- src/setting.ts | 3 --- src/sync.ts | 45 +++++++++++++++++++++------------------------ 5 files changed, 26 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index 419379ae..8b80ad0d 100644 --- a/package.json +++ b/package.json @@ -154,6 +154,8 @@ "devDependencies": { "@types/fs-extra": "^5.0.4", "@types/node": "^10.7.0", + "@types/chai":"4.1.6", + "@types/mocha": "^5.2.0", "chai": "^4.2.0", "mocha": "^5.2.0", "prettier": "^1.14.2", diff --git a/package.nls.json b/package.nls.json index ed9c4648..82d9a237 100644 --- a/package.nls.json +++ b/package.nls.json @@ -98,5 +98,6 @@ "common.placeholder.multipleGist": "Gist Name (e.g : Personal Settings)", "common.prompt.multipleGist": "Allows you to identify the settings if you have multiple gist.", "common.prompt.enterGistId": "Enter Gist Id from previously uploaded settings. You can also set manually in code settings (sync.gist). Press [Enter] or [Esc] to cancel.", - "common.prompt.enterGithubAccessToken": "You can manually add token also (User Folder / syncLocalSettings.json). Press [Enter] or [Esc] to cancel." + "common.prompt.enterGithubAccessToken": "You can manually add token also (User Folder / syncLocalSettings.json). Press [Enter] or [Esc] to cancel.", + "common.prompt.restartCode":"Do you want to reload to apply extensions and configurations ?" } diff --git a/src/commons.ts b/src/commons.ts index ea84e5b6..d679d130 100644 --- a/src/commons.ts +++ b/src/commons.ts @@ -11,6 +11,7 @@ import { CustomSettings, ExtensionConfig, LocalConfig } from "./setting"; import { Util } from "./util"; export default class Commons { + public static outputChannel: vscode.OutputChannel = null; public static LogException( error: any, message: string, @@ -76,7 +77,6 @@ export default class Commons { private static configWatcher = null; private static extensionWatcher = null; - private static outputChannel: vscode.OutputChannel = null; public ERROR_MESSAGE: string = localize("common.error.message"); @@ -639,7 +639,6 @@ export default class Commons { } const outputChannel = Commons.outputChannel; - outputChannel.clear(); outputChannel.appendLine( `CODE SETTINGS SYNC ${upload ? "UPLOAD" : "DOWNLOAD"} SUMMARY` ); diff --git a/src/setting.ts b/src/setting.ts index e0585e41..59c5513a 100644 --- a/src/setting.ts +++ b/src/setting.ts @@ -52,9 +52,6 @@ export class CustomSettings { public lastDownload: Date = null; public githubEnterpriseUrl: string = null; public askGistName: boolean = false; - public customFiles: { [key: string]: string } = {}; - public hostName: string = null; - } diff --git a/src/sync.ts b/src/sync.ts index 4b4b9e42..2d5fafb4 100644 --- a/src/sync.ts +++ b/src/sync.ts @@ -525,21 +525,6 @@ export class Sync { deletedExtensions = uncompletedExtensions; } } - let outputChannel: vscode.OutputChannel = null; - if (!syncSetting.quietSync) { - outputChannel = vscode.window.createOutputChannel( - "Code Settings Sync" - ); - outputChannel.clear(); - outputChannel.appendLine( - `CODE SETTINGS SYNC - COMMAND LINE EXTENSION DOWNLOAD SUMMARY` - ); - outputChannel.appendLine( - `Version: ${Environment.getVersion()}` - ); - outputChannel.appendLine(`--------------------`); - outputChannel.show(); - } try { let useCli = true; @@ -547,6 +532,18 @@ export class Sync { .getConfiguration("extensions") .get("autoUpdate"); useCli = autoUpdate; + if (useCli) { + if (!syncSetting.quietSync) { + Commons.outputChannel = vscode.window.createOutputChannel( + "Code Settings Sync" + ); + Commons.outputChannel.clear(); + Commons.outputChannel.appendLine( + `COMMAND LINE EXTENSION DOWNLOAD SUMMARY` + ); + Commons.outputChannel.appendLine(`--------------------`); + } + } addedExtensions = await PluginService.InstallExtensions( content, @@ -557,7 +554,7 @@ export class Sync { env.isInsiders, (message: string, dispose: boolean) => { if (!syncSetting.quietSync) { - outputChannel.appendLine(message); + Commons.outputChannel.appendLine(message); } else { console.log(message); if (dispose) { @@ -569,16 +566,8 @@ export class Sync { } } ); - if (!syncSetting.quietSync) { - outputChannel.clear(); - outputChannel.dispose(); - } } catch (extensions) { addedExtensions = extensions; - if (!syncSetting.quietSync) { - outputChannel.clear(); - outputChannel.dispose(); - } } } } else { @@ -647,6 +636,14 @@ export class Sync { null, localSettings ); + const message = await vscode.window.showInformationMessage( + localize("common.prompt.restartCode"), + "Yes" + ); + + if (message === "Yes") { + vscode.commands.executeCommand("workbench.action.reloadWindow"); + } vscode.window.setStatusBarMessage("").dispose(); } else { vscode.window.setStatusBarMessage("").dispose();