add config for open after save behavior (#15675)

This commit is contained in:
Alan Ren
2021-06-10 13:32:05 -07:00
committed by GitHub
parent 922d1287ac
commit eea8c61b6e
3 changed files with 10 additions and 3 deletions

View File

@@ -20,7 +20,8 @@ export interface IQueryEditorConfiguration {
readonly copyIncludeHeaders: boolean, readonly copyIncludeHeaders: boolean,
readonly copyRemoveNewLine: boolean, readonly copyRemoveNewLine: boolean,
readonly optimizedTable: boolean, readonly optimizedTable: boolean,
readonly inMemoryDataProcessingThreshold: number readonly inMemoryDataProcessingThreshold: number,
readonly openAfterSave: boolean
}, },
readonly messages: { readonly messages: {
readonly showBatchTime: boolean, readonly showBatchTime: boolean,

View File

@@ -396,6 +396,11 @@ const queryEditorConfiguration: IConfigurationNode = {
'default': 5000, '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.") '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': { 'queryEditor.messages.showBatchTime': {
'type': 'boolean', 'type': 'boolean',
'description': localize('queryEditor.messages.showBatchTime', "Should execution time be shown for individual batches"), 'description': localize('queryEditor.messages.showBatchTime', "Should execution time be shown for individual batches"),

View File

@@ -314,7 +314,8 @@ export class ResultSerializer {
* Open the saved file in a new vscode editor pane * Open the saved file in a new vscode editor pane
*/ */
private openSavedFile(filePath: URI, format: string): void { private openSavedFile(filePath: URI, format: string): void {
if (format !== SaveFormat.EXCEL) { const openAfterSaveConfig = this._configurationService.getValue<IQueryEditorConfiguration>('queryEditor').results.openAfterSave;
if (format !== SaveFormat.EXCEL && openAfterSaveConfig) {
this._editorService.openEditor({ resource: filePath }).then((result) => { this._editorService.openEditor({ resource: filePath }).then((result) => {
}, (error: any) => { }, (error: any) => {
@@ -330,7 +331,7 @@ export class ResultSerializer {
[{ [{
label: nls.localize('openFile', "Open file"), label: nls.localize('openFile', "Open file"),
run: () => { run: () => {
this.openerService.open(filePath, { openExternal: true }); this.openerService.open(filePath, { openExternal: format === SaveFormat.EXCEL });
} }
}] }]
); );