mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 01:25:36 -05:00
Fix access to query editor configuration (#11321)
* fix access to query editor configuration * fix configuration type * fix setting type
This commit is contained in:
@@ -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<boolean>('sql.showBatchTime');
|
||||
let showBatchTime = this.configurationService.getValue<IQueryEditorConfiguration>('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<boolean>('sql.copyIncludeHeaders');
|
||||
includeHeaders = configurationService.getValue<IQueryEditorConfiguration>('queryEditor').results.copyIncludeHeaders;
|
||||
return !!includeHeaders;
|
||||
}
|
||||
|
||||
export function shouldRemoveNewLines(configurationService: IConfigurationService): boolean {
|
||||
// get config copyRemoveNewLine option from vscode config
|
||||
let removeNewLines = configurationService.getValue<boolean>('sql.copyRemoveNewLine');
|
||||
let removeNewLines = configurationService.getValue<IQueryEditorConfiguration>('queryEditor').results.copyRemoveNewLine;
|
||||
return !!removeNewLines;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 = <SaveResultsRequestParams>{ resultFormat: SaveFormat.CSV as string };
|
||||
|
||||
// get save results config from vscode config
|
||||
let saveConfig = this._configurationService.getValue<ICsvConfig>('sql.saveAsCsv');
|
||||
let saveConfig = this._configurationService.getValue<IQueryEditorConfiguration>('queryEditor').results.saveAsCsv;
|
||||
// if user entered config, set options
|
||||
if (saveConfig) {
|
||||
if (saveConfig.includeHeaders !== undefined) {
|
||||
@@ -245,7 +233,7 @@ export class ResultSerializer {
|
||||
let saveResultsParams = <SaveResultsRequestParams>{ resultFormat: SaveFormat.XML as string };
|
||||
|
||||
// get save results config from vscode config
|
||||
let saveConfig = this._configurationService.getValue<IXmlConfig>('sql.saveAsXml');
|
||||
let saveConfig = this._configurationService.getValue<IQueryEditorConfiguration>('queryEditor').results.saveAsXml;
|
||||
// if user entered config, set options
|
||||
if (saveConfig) {
|
||||
if (saveConfig.formatted !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user