Skip to content

Commit 6a5f6cf

Browse files
Merge pull request #528 from KxSystems/v.1.10.2-dev-to-main
V.1.10.2 dev to main
2 parents 0e379bf + c00f1cd commit 6a5f6cf

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

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

5+
# v1.10.2
6+
7+
### Fixes
8+
9+
- Resolved issue with export csv method
10+
511
# v1.10.1
612

713
### Fixes

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "kdb",
44
"description": "IDE support for kdb product suite including the q programming language",
55
"publisher": "KX",
6-
"version": "1.10.1",
6+
"version": "1.10.2",
77
"engines": {
88
"vscode": "^1.86.0"
99
},

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)