From 12ec90dd56a2527fdb254d9e47e888318a30e43a Mon Sep 17 00:00:00 2001 From: yungez Date: Mon, 11 Jun 2018 11:41:49 +0800 Subject: [PATCH 1/2] add config for copy workspace --- package.json | 7 ++++++- src/sshRunner.ts | 14 ++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 47e7e96..84b3140 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ { "command": "vscode-ansible.sync-folder-ssh", "title": "Copy folder to Remote Host", - "category": "Ansible" + "category": "Ansible" } ], "menus": { @@ -151,6 +151,11 @@ "type": "boolean", "default": true, "description": "Enable/Disable ansible autocompletion" + }, + "ansible.copyWorkspace": { + "type": "boolean", + "default": false, + "description": "Enable/Disable copying whole workspace to remote SSH host" } } } diff --git a/src/sshRunner.ts b/src/sshRunner.ts index ef457d9..a72c3dc 100644 --- a/src/sshRunner.ts +++ b/src/sshRunner.ts @@ -61,13 +61,10 @@ export class SSHRunner extends TerminalBaseRunner { let targetPlaybook = target; - // ask for weather to sync workspace - const cancelItem: vscode.MessageItem = { title: "Cancel" }; - const okItem: vscode.MessageItem = { title: "Ok" }; - let response = await vscode.window.showWarningMessage('Copy Workspace to Remote host?', okItem, cancelItem); - - if (response && response === okItem) { + // check configuration weather to sync workspace + let copyWorkspace = utilities.getCodeConfiguration('ansible', 'copyWorkspace'); + if (copyWorkspace) { src = utilities.getWorkspaceRoot(playbook) + '/'; target = path.join('\./', path.basename(src)) + '/'; targetPlaybook = ['\./' + path.basename(src), path.relative(src, playbook)].join(path.posix.sep).replace(/\\/g, '/'); @@ -77,10 +74,7 @@ export class SSHRunner extends TerminalBaseRunner { } catch (err) { return; } - } - - if (!response || response === cancelItem) { - + } else { this._outputChannel.append('\nCopying ' + src + ' to ' + targetServer.host + '..'); this._outputChannel.show(); From b424950e57b5fefd7ca761612cc8ed62d0c89322 Mon Sep 17 00:00:00 2001 From: yungez Date: Mon, 11 Jun 2018 17:06:18 +0800 Subject: [PATCH 2/2] trim --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 84b3140..790a5ab 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ { "command": "vscode-ansible.sync-folder-ssh", "title": "Copy folder to Remote Host", - "category": "Ansible" + "category": "Ansible" } ], "menus": {