diff --git a/package.json b/package.json index c7901da9..05f29c49 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "code-settings-sync", "displayName": "Visual Studio Code Settings Sync", "description": "Synchronize Settings, Snippets, launch, keybindings files and extensions Across Multiple Machines using Github GIST.", - "version": "1.5.0", + "version": "1.6.0", "icon": "images/cloud.png", "publisher": "Shan", "author": { @@ -31,12 +31,21 @@ "onCommand:extension.updateSettings", "onCommand:extension.downloadSettings", "onCommand:extension.resetSettings", - "onCommand:extension.releaseNotes" + "onCommand:extension.releaseNotes", + "onCommand:extension.openSettings", + "onCommand:extension.HowSettings" ], "main": "./out/src/extension", "contributes": { "commands": [ - + { + "command": "extension.openSettings", + "title": "Sync : Open Settings" + }, + { + "command": "extension.HowSettings", + "title": "Sync : How To Configure" + }, { "command": "extension.downloadSettings", "title": "Sync : Download Settings" diff --git a/src/commons.ts b/src/commons.ts index 4c357a78..d49db5ad 100644 --- a/src/commons.ts +++ b/src/commons.ts @@ -85,15 +85,19 @@ export class Commons { (function getToken() { vscode.window.showInputBox(opt).then(async (token) => { if (token && token.trim()) { - sett.Token = token.trim(); - await me.SaveSettings(sett).then(function (saved: boolean) { - if (saved) { - vscode.window.setStatusBarMessage("Token Saved", 1000); - } - resolve(saved); - }, function (err: any) { - reject(err); - }); + token = token.trim(); + + if (token != 'esc') { + sett.Token = token; + await me.SaveSettings(sett).then(function (saved: boolean) { + if (saved) { + vscode.window.setStatusBarMessage("Token Saved", 1000); + } + resolve(saved); + }, function (err: any) { + reject(err); + }); + } } else { if (token !== 'esc') { getToken() @@ -110,22 +114,27 @@ export class Commons { (function getGist() { vscode.window.showInputBox(opt).then(async (gist) => { if (gist && gist.trim()) { - sett.Gist = gist.trim(); - await me.SaveSettings(sett).then(function (saved: boolean) { - if (saved) { - vscode.window.setStatusBarMessage("Gist Saved", 1000); - } - resolve(saved); - }, function (err: any) { - reject(err); - }); + gist = gist.trim(); + if (gist != 'esc') { + sett.Gist = gist.trim(); + await me.SaveSettings(sett).then(function (saved: boolean) { + if (saved) { + vscode.window.setStatusBarMessage("Gist Saved", 1000); + } + resolve(saved); + }, function (err: any) { + reject(err); + }); + } + } else { if (gist !== 'esc') { - getGist() + getGist(); } } + }); - }); + })(); }); } @@ -137,7 +146,7 @@ export class Commons { let options: vscode.InputBoxOptions = { placeHolder: "Enter Github Personal Access Token", password: false, - prompt: "Link is opened to get the github token. Enter token and press [Enter] or type 'esc' to cancel......................................................." + prompt: "Link is opened to get the github token. Enter token and press [Enter] or type 'esc' to cancel." }; return options; } @@ -145,7 +154,7 @@ export class Commons { let options: vscode.InputBoxOptions = { placeHolder: "Enter GIST ID", password: false, - prompt: "Enter GIST ID from previously uploaded settings and press [Enter] or type 'esc' to cancel................................................................." + prompt: "Enter GIST ID from previously uploaded settings and press [Enter] or type 'esc' to cancel." }; return options; } diff --git a/src/extension.ts b/src/extension.ts index d9b34162..11261823 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -419,5 +419,32 @@ export function activate(context: vscode.ExtensionContext) { openurl("http://shanalikhan.github.io/2016/05/14/Visual-studio-code-sync-settings-release-notes.html"); }); + var disposable = vscode.commands.registerCommand('extension.openSettings', async () => { + + openurl("http://shanalikhan.github.io/2016/07/31/Visual-Studio-code-sync-setting-edit-manually.html"); + vscode.window.showInformationMessage("If the extension is not setup then use How To Configure command to setup this extension."); + + vscode.window.showInformationMessage("Read link is opened if you need help in editing the JSON File manually."); + + var en: envir.Environment = new envir.Environment(context); + var fManager: fileManager.FileManager; + var common: commons.Commons = new commons.Commons(en); + var syncSetting: Setting = await common.InitSettings(); + + + var setting : vscode.Uri = vscode.Uri.file(en.APP_SETTINGS); + vscode.workspace.openTextDocument(setting).then((a: vscode.TextDocument) => { + vscode.window.showTextDocument(a,1,false); + }); + + + }); + + var disposable = vscode.commands.registerCommand('extension.HowSettings', async () => { + openurl("http://shanalikhan.github.io/2015/12/15/Visual-Studio-Code-Sync-Settings.html"); + }); + + + context.subscriptions.push(disposable); } diff --git a/src/setting.ts b/src/setting.ts index ab9ee2b4..fac7840c 100644 --- a/src/setting.ts +++ b/src/setting.ts @@ -2,6 +2,4 @@ export class Setting{ public Token : string = null; public Gist : string = null; - public ProxyIP : string = null; - public ProxyPort : string = null; } \ No newline at end of file