mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 09:35:38 -05:00
Notebooks: fix save as csv/excel/json/xml (#14882)
* add getEncoding method to notebooks * fix row 501 missing in serialization * fix row index * pr comment
This commit is contained in:
@@ -45,4 +45,8 @@ export class FileNotebookInput extends NotebookInput {
|
||||
public getTypeId(): string {
|
||||
return FileNotebookInput.ID;
|
||||
}
|
||||
|
||||
public getEncoding(): string | undefined {
|
||||
return this.textInput.getEncoding();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,4 +42,8 @@ export class UntitledNotebookInput extends NotebookInput {
|
||||
public getTypeId(): string {
|
||||
return UntitledNotebookInput.ID;
|
||||
}
|
||||
|
||||
public getEncoding(): string | undefined {
|
||||
return this.textInput.getEncoding();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import { localize } from 'vs/nls';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { Table } from 'sql/base/browser/ui/table/table';
|
||||
import { QueryEditor } from './queryEditor';
|
||||
import { UntitledQueryEditorInput } from 'sql/workbench/common/editor/query/untitledQueryEditorInput';
|
||||
import { CellSelectionModel } from 'sql/base/browser/ui/table/plugins/cellSelectionModel.plugin';
|
||||
import { IGridDataProvider } from 'sql/workbench/services/query/common/gridDataProvider';
|
||||
import { INotificationService, Severity, NeverShowAgainScope } from 'vs/platform/notification/common/notification';
|
||||
@@ -20,6 +19,7 @@ import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
import { getErrorMessage } from 'vs/base/common/errors';
|
||||
import { SaveFormat } from 'sql/workbench/services/query/common/resultSerializer';
|
||||
import { IExtensionRecommendationsService } from 'vs/workbench/services/extensionRecommendations/common/extensionRecommendations';
|
||||
import { IEncodingSupport } from 'vs/workbench/common/editor';
|
||||
|
||||
export interface IGridActionContext {
|
||||
gridDataProvider: IGridDataProvider;
|
||||
@@ -70,9 +70,8 @@ export class SaveResultAction extends Action {
|
||||
|
||||
public async run(context: IGridActionContext): Promise<boolean> {
|
||||
|
||||
const activeEditor = this.editorService.activeEditorPane as QueryEditor;
|
||||
let input = activeEditor.input as UntitledQueryEditorInput;
|
||||
if (input.getEncoding() !== 'utf8') {
|
||||
const activeEditor = this.editorService.activeEditorPane as unknown as IEncodingSupport;
|
||||
if (typeof activeEditor.getEncoding === 'function' && activeEditor.getEncoding() !== 'utf8') {
|
||||
this.notificationService.notify({
|
||||
severity: Severity.Info,
|
||||
message: localize('jsonEncoding', "Results encoding will not be saved when exporting to JSON, remember to save with desired encoding once file is created."),
|
||||
|
||||
Reference in New Issue
Block a user