From eea8c61b6efcdf37c070a8e435bbf26210b65fa7 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Thu, 10 Jun 2021 13:32:05 -0700 Subject: [PATCH] add config for open after save behavior (#15675) --- src/sql/platform/query/common/query.ts | 3 ++- .../workbench/contrib/query/browser/query.contribution.ts | 5 +++++ src/sql/workbench/services/query/common/resultSerializer.ts | 5 +++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/sql/platform/query/common/query.ts b/src/sql/platform/query/common/query.ts index 0e6947c4d1..f33c0dee41 100644 --- a/src/sql/platform/query/common/query.ts +++ b/src/sql/platform/query/common/query.ts @@ -20,7 +20,8 @@ export interface IQueryEditorConfiguration { readonly copyIncludeHeaders: boolean, readonly copyRemoveNewLine: boolean, readonly optimizedTable: boolean, - readonly inMemoryDataProcessingThreshold: number + readonly inMemoryDataProcessingThreshold: number, + readonly openAfterSave: boolean }, readonly messages: { readonly showBatchTime: boolean, diff --git a/src/sql/workbench/contrib/query/browser/query.contribution.ts b/src/sql/workbench/contrib/query/browser/query.contribution.ts index 333648750f..f0e974415d 100644 --- a/src/sql/workbench/contrib/query/browser/query.contribution.ts +++ b/src/sql/workbench/contrib/query/browser/query.contribution.ts @@ -396,6 +396,11 @@ const queryEditorConfiguration: IConfigurationNode = { 'default': 5000, 'description': localize('queryEditor.inMemoryDataProcessingThreshold', "Controls the max number of rows allowed to do filtering and sorting in memory. If the number is exceeded, sorting and filtering will be disabled. Warning: Increasing this may impact performance.") }, + 'queryEditor.results.openAfterSave': { + 'type': 'boolean', + 'description': localize('queryEditor.results.openAfterSave', "Whether to open the file in Azure Data Studio after the result is saved."), + 'default': true + }, 'queryEditor.messages.showBatchTime': { 'type': 'boolean', 'description': localize('queryEditor.messages.showBatchTime', "Should execution time be shown for individual batches"), diff --git a/src/sql/workbench/services/query/common/resultSerializer.ts b/src/sql/workbench/services/query/common/resultSerializer.ts index 927102470e..e26fa68e7e 100644 --- a/src/sql/workbench/services/query/common/resultSerializer.ts +++ b/src/sql/workbench/services/query/common/resultSerializer.ts @@ -314,7 +314,8 @@ export class ResultSerializer { * Open the saved file in a new vscode editor pane */ private openSavedFile(filePath: URI, format: string): void { - if (format !== SaveFormat.EXCEL) { + const openAfterSaveConfig = this._configurationService.getValue('queryEditor').results.openAfterSave; + if (format !== SaveFormat.EXCEL && openAfterSaveConfig) { this._editorService.openEditor({ resource: filePath }).then((result) => { }, (error: any) => { @@ -330,7 +331,7 @@ export class ResultSerializer { [{ label: nls.localize('openFile', "Open file"), run: () => { - this.openerService.open(filePath, { openExternal: true }); + this.openerService.open(filePath, { openExternal: format === SaveFormat.EXCEL }); } }] );