From 849653927a095949bcea6a565c3be58e0c00828a Mon Sep 17 00:00:00 2001 From: Kevin Cunnane Date: Sat, 7 Apr 2018 13:16:05 -0700 Subject: [PATCH] Fix #1095 "Run kinit" helper no longer runs kinit (#1102) VSCode refactored their terminal to have more delayed initialization, but still return as complete before the actual instance is ready for focus and paste events. The fix is to add a delay so this can complete before calling the paste action. As this doesn't affect extensions (the hop to the extension host causes a delay) I'm not raising this with VSCode as an upstream issue, just fixing on our side --- .../connection/connectionDialog/connectionDialogService.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sql/parts/connection/connectionDialog/connectionDialogService.ts b/src/sql/parts/connection/connectionDialog/connectionDialogService.ts index 7780ae395c..728107292a 100644 --- a/src/sql/parts/connection/connectionDialog/connectionDialogService.ts +++ b/src/sql/parts/connection/connectionDialog/connectionDialogService.ts @@ -346,7 +346,10 @@ export class ConnectionDialogService implements IConnectionDialogService { this._connectionDialog.close(); this._clipboardService.writeText('kinit\r'); this._commandService.executeCommand('workbench.action.terminal.focus').then(resolve => { - return this._commandService.executeCommand('workbench.action.terminal.paste'); + // setTimeout to allow for terminal Instance to load. + setTimeout(() => { + return this._commandService.executeCommand('workbench.action.terminal.paste'); + }, 10); }).then(resolve => null, reject => null); return null; }));