diff --git a/CHANGELOG.md b/CHANGELOG.md index e63152ab..823fdb81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,16 +2,12 @@ All notable changes to the **kdb VS Code extension** are documented in this file. -# v1.10.0 - -### Enhancements - -- Introducing UDAs(Custom APIs) to Datasource -- Run UDAs with Requirement params or with no required params -- VsCode is Query Environment variable aware from Insights 1.13 +# v1.10.2 ### Fixes +- Resolved issue with export csv method + # v1.10.1 ### Fixes diff --git a/src/utils/execution.ts b/src/utils/execution.ts index a3670073..b504690c 100644 --- a/src/utils/execution.ts +++ b/src/utils/execution.ts @@ -16,6 +16,7 @@ import path from "path"; import { Uri, window, workspace } from "vscode"; import { ext } from "../extensionVariables"; import { QueryResultType } from "../models/queryResult"; +import { kdbOutputLog } from "./core"; interface tblHeader { label: string; @@ -124,9 +125,17 @@ export function convertResultToVector(result: any): any[] { export async function exportToCsv(workspaceUri: Uri): Promise { const timestamp = Date.now(); const fileName = `results-${timestamp}.csv`; - const filePath = Uri.parse(path.join(workspaceUri.fsPath, fileName)); - await workspace.fs.writeFile(filePath, Buffer.from(ext.resultPanelCSV)); - window.showTextDocument(filePath, { preview: false }); + const filePath = Uri.file(path.join(workspaceUri.fsPath, fileName)); + + try { + await workspace.fs.writeFile(filePath, Buffer.from(ext.resultPanelCSV)); + kdbOutputLog("file located at: " + filePath.fsPath, "INFO"); + window.showTextDocument(filePath, { preview: false }); + } catch (error) { + const errorMessage = error instanceof Error ? error.message : String(error); + kdbOutputLog(`Error writing file: ${errorMessage}`, "ERROR"); + window.showErrorMessage(`Failed to write file: ${errorMessage}`); + } } export function convertArrayOfArraysToObjects(arr: any): any[] {