diff --git a/src/sql/platform/query/common/query.ts b/src/sql/platform/query/common/query.ts index 27dc797d65..1506323bb5 100644 --- a/src/sql/platform/query/common/query.ts +++ b/src/sql/platform/query/common/query.ts @@ -13,7 +13,7 @@ export interface IQueryEditorConfiguration { readonly encoding: string }, readonly saveAsXml: { - readonly formatted: string, + readonly formatted: boolean, readonly encoding: string }, readonly streaming: boolean, diff --git a/src/sql/workbench/common/editor/query/queryEditorInput.ts b/src/sql/workbench/common/editor/query/queryEditorInput.ts index fd7402a100..da75e991a0 100644 --- a/src/sql/workbench/common/editor/query/queryEditorInput.ts +++ b/src/sql/workbench/common/editor/query/queryEditorInput.ts @@ -18,6 +18,7 @@ import { ExecutionPlanOptions } from 'azdata'; import { startsWith } from 'vs/base/common/strings'; import { IRange } from 'vs/editor/common/core/range'; import { AbstractTextResourceEditorInput } from 'vs/workbench/common/editor/textResourceEditorInput'; +import { IQueryEditorConfiguration } from 'sql/platform/query/common/query'; const MAX_SIZE = 13; @@ -156,7 +157,7 @@ export abstract class QueryEditorInput extends EditorInput implements IConnectab })); this._register(this.configurationService.onDidChangeConfiguration(e => { - if (e.affectedKeys.indexOf('sql.showConnectionInfoInTitle') > -1) { + if (e.affectedKeys.indexOf('queryEditor') > -1) { this._onDidChangeLabel.fire(); } })); @@ -196,7 +197,7 @@ export abstract class QueryEditorInput extends EditorInput implements IConnectab public get resource(): URI { return this._text.resource; } public getName(longForm?: boolean): string { - if (this.configurationService.getValue('sql.showConnectionInfoInTitle')) { + if (this.configurationService.getValue('queryEditor').showConnectionInfoInTitle) { let profile = this.connectionManagementService.getConnectionProfile(this.uri); let title = ''; if (this._description && this._description !== '') { diff --git a/src/sql/workbench/contrib/query/browser/query.contribution.ts b/src/sql/workbench/contrib/query/browser/query.contribution.ts index 1275564a27..e306f3f395 100644 --- a/src/sql/workbench/contrib/query/browser/query.contribution.ts +++ b/src/sql/workbench/contrib/query/browser/query.contribution.ts @@ -341,7 +341,7 @@ const queryEditorConfiguration: IConfigurationNode = { 'default': 'utf-8' }, 'queryEditor.results.saveAsXml.formatted': { - 'type': 'string', + 'type': 'boolean', 'description': localize('queryEditor.results.saveAsXml.formatted', "When true, XML output will be formatted when saving results as XML"), 'default': true }, diff --git a/src/sql/workbench/services/query/common/queryRunner.ts b/src/sql/workbench/services/query/common/queryRunner.ts index 331c8bd4c9..07b60baf8c 100644 --- a/src/sql/workbench/services/query/common/queryRunner.ts +++ b/src/sql/workbench/services/query/common/queryRunner.ts @@ -26,6 +26,7 @@ import { ILogService } from 'vs/platform/log/common/log'; import { find } from 'vs/base/common/arrays'; import { IRange, Range } from 'vs/editor/common/core/range'; import { BatchSummary, IQueryMessage, ResultSetSummary, QueryExecuteSubsetParams, CompleteBatchSummary, IResultMessage, ResultSetSubset, BatchStartSummary } from './query'; +import { IQueryEditorConfiguration } from 'sql/platform/query/common/query'; /* * Query Runner class which handles running a query, reports the results to the content manager, @@ -442,7 +443,7 @@ export default class QueryRunner extends Disposable { private sendBatchTimeMessage(batchId: number, executionTime: string): void { // get config copyRemoveNewLine option from vscode config - let showBatchTime = this.configurationService.getValue('sql.showBatchTime'); + let showBatchTime = this.configurationService.getValue('queryEditor').messages.showBatchTime; if (showBatchTime) { let message: IQueryMessage = { batchId: batchId, @@ -538,13 +539,13 @@ export function shouldIncludeHeaders(includeHeaders: boolean, configurationServi return includeHeaders; } // else get config option from vscode config - includeHeaders = configurationService.getValue('sql.copyIncludeHeaders'); + includeHeaders = configurationService.getValue('queryEditor').results.copyIncludeHeaders; return !!includeHeaders; } export function shouldRemoveNewLines(configurationService: IConfigurationService): boolean { // get config copyRemoveNewLine option from vscode config - let removeNewLines = configurationService.getValue('sql.copyRemoveNewLine'); + let removeNewLines = configurationService.getValue('queryEditor').results.copyRemoveNewLine; return !!removeNewLines; } diff --git a/src/sql/workbench/services/query/common/resultSerializer.ts b/src/sql/workbench/services/query/common/resultSerializer.ts index 363f8158e4..b870d8f2a1 100644 --- a/src/sql/workbench/services/query/common/resultSerializer.ts +++ b/src/sql/workbench/services/query/common/resultSerializer.ts @@ -17,6 +17,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic import { getRootPath, resolveCurrentDirectory } from 'sql/platform/common/pathUtilities'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IFileDialogService, FileFilter } from 'vs/platform/dialogs/common/dialogs'; +import { IQueryEditorConfiguration } from 'sql/platform/query/common/query'; let prevSavePath: URI; @@ -32,19 +33,6 @@ export interface SaveResultsResponse { messages?: string; } -interface ICsvConfig { - includeHeaders: boolean; - delimiter: string; - lineSeperator: string; - textIdentifier: string; - encoding: string; -} - -interface IXmlConfig { - formatted: boolean; - encoding: string; -} - export enum SaveFormat { CSV = 'csv', JSON = 'json', @@ -199,7 +187,7 @@ export class ResultSerializer { let saveResultsParams = { resultFormat: SaveFormat.CSV as string }; // get save results config from vscode config - let saveConfig = this._configurationService.getValue('sql.saveAsCsv'); + let saveConfig = this._configurationService.getValue('queryEditor').results.saveAsCsv; // if user entered config, set options if (saveConfig) { if (saveConfig.includeHeaders !== undefined) { @@ -245,7 +233,7 @@ export class ResultSerializer { let saveResultsParams = { resultFormat: SaveFormat.XML as string }; // get save results config from vscode config - let saveConfig = this._configurationService.getValue('sql.saveAsXml'); + let saveConfig = this._configurationService.getValue('queryEditor').results.saveAsXml; // if user entered config, set options if (saveConfig) { if (saveConfig.formatted !== undefined) { diff --git a/src/sql/workbench/services/queryEditor/browser/queryEditorService.ts b/src/sql/workbench/services/queryEditor/browser/queryEditorService.ts index 39077b7214..1ec009cce8 100644 --- a/src/sql/workbench/services/queryEditor/browser/queryEditorService.ts +++ b/src/sql/workbench/services/queryEditor/browser/queryEditorService.ts @@ -19,6 +19,7 @@ import { IUntitledTextEditorService } from 'vs/workbench/services/untitled/commo import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput'; import { UntitledTextEditorModel } from 'vs/workbench/services/untitled/common/untitledTextEditorModel'; import { mixin } from 'vs/base/common/objects'; +import { IQueryEditorConfiguration } from 'sql/platform/query/common/query'; const defaults: INewSqlEditorOptions = { open: true @@ -55,7 +56,7 @@ export class QueryEditorService implements IQueryEditorService { let untitledEditorModel = await fileInput.resolve() as UntitledTextEditorModel; if (options.initalContent) { untitledEditorModel.textEditorModel.setValue(options.initalContent); - if (options.dirty === false || (options.dirty === undefined && !this._configurationService.getValue('sql.promptToSaveGeneratedFiles'))) { + if (options.dirty === false || (options.dirty === undefined && !this._configurationService.getValue('queryEditor').promptToSaveGeneratedFiles)) { untitledEditorModel.setDirty(false); } }