Skip to content

Commit 9bb33aa

Browse files
Merge pull request #530 from KxSystems/main-1.10.2-to-dev
Main 1.10.2 to dev
2 parents 3879a74 + f304f9f commit 9bb33aa

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

CHANGELOG.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22

33
All notable changes to the **kdb VS Code extension** are documented in this file.
44

5-
# v1.10.0
6-
7-
### Enhancements
8-
9-
- Introducing UDAs(Custom APIs) to Datasource
10-
- Run UDAs with Requirement params or with no required params
11-
- VsCode is Query Environment variable aware from Insights 1.13
5+
# v1.10.2
126

137
### Fixes
148

9+
- Resolved issue with export csv method
10+
1511
# v1.10.1
1612

1713
### Fixes

src/utils/execution.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import path from "path";
1616
import { Uri, window, workspace } from "vscode";
1717
import { ext } from "../extensionVariables";
1818
import { QueryResultType } from "../models/queryResult";
19+
import { kdbOutputLog } from "./core";
1920

2021
interface tblHeader {
2122
label: string;
@@ -124,9 +125,17 @@ export function convertResultToVector(result: any): any[] {
124125
export async function exportToCsv(workspaceUri: Uri): Promise<void> {
125126
const timestamp = Date.now();
126127
const fileName = `results-${timestamp}.csv`;
127-
const filePath = Uri.parse(path.join(workspaceUri.fsPath, fileName));
128-
await workspace.fs.writeFile(filePath, Buffer.from(ext.resultPanelCSV));
129-
window.showTextDocument(filePath, { preview: false });
128+
const filePath = Uri.file(path.join(workspaceUri.fsPath, fileName));
129+
130+
try {
131+
await workspace.fs.writeFile(filePath, Buffer.from(ext.resultPanelCSV));
132+
kdbOutputLog("file located at: " + filePath.fsPath, "INFO");
133+
window.showTextDocument(filePath, { preview: false });
134+
} catch (error) {
135+
const errorMessage = error instanceof Error ? error.message : String(error);
136+
kdbOutputLog(`Error writing file: ${errorMessage}`, "ERROR");
137+
window.showErrorMessage(`Failed to write file: ${errorMessage}`);
138+
}
130139
}
131140

132141
export function convertArrayOfArraysToObjects(arr: any): any[] {

0 commit comments

Comments
 (0)