diff --git a/src/sql/workbench/contrib/commandLine/electron-browser/commandLine.ts b/src/sql/workbench/contrib/commandLine/electron-browser/commandLine.ts index 04f6557e9c..189851d66d 100644 --- a/src/sql/workbench/contrib/commandLine/electron-browser/commandLine.ts +++ b/src/sql/workbench/contrib/commandLine/electron-browser/commandLine.ts @@ -169,7 +169,7 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution, } public async handleURL(uri: URI): Promise { - let key = uri.authority.toLowerCase(); + let key = uri.authority; let method = pathMappings[key]; @@ -207,6 +207,29 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution, return true; } + @pathHandler({ + path: 'openConnectionDialog' + }) + public async handleOpenConnectionDialog(uri: URI): Promise { + try { + let args = this.parseProtocolArgs(uri); + if (!args.server) { + this._notificationService.warn(localize('warnServerRequired', "Cannot connect as no server information was provided")); + return true; + } + let isOpenOk = await this.confirmConnect(args); + if (!isOpenOk) { + return false; + } + + const connectionProfile = this.readProfileFromArgs(args); + await this._connectionManagementService.showConnectionDialog(undefined, undefined, connectionProfile); + } catch (err) { + this._notificationService.error(localize('errConnectUrl', "Could not open URL due to error {0}", getErrorMessage(err))); + } + return true; + } + private async confirmConnect(args: SqlArgs): Promise { let detail = args && args.server ? localize('connectServerDetail', "This will connect to server {0}", args.server) : ''; const result = await this.dialogService.confirm({