Skip to content
This repository was archived by the owner on Dec 8, 2025. It is now read-only.

Commit 494b69d

Browse files
committed
fix: set validation results default file path to current document + validation key
1 parent ffe966c commit 494b69d

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src-electron/electron-preload.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ contextBridge.exposeInMainWorld('ipcBridge', {
4242
gitDiscardChanges: (files) => ipcRenderer.invoke('gitDiscardChanges', { files }),
4343
gitCommit: (message) => ipcRenderer.invoke('gitCommit', { message }),
4444
lspSendRequest: (method, params) => ipcRenderer.invoke('lspSendRequest', { method, params }),
45-
saveValidationResults: (output) => ipcRenderer.invoke('saveValidationResults', { output }),
45+
saveValidationResults: (output, filePath) => ipcRenderer.invoke('saveValidationResults', { output, filePath }),
4646
persistSession: (data) => ipcRenderer.invoke('persistSession', data),
4747
restoreSession: () => ipcRenderer.invoke('restoreSession')
4848
})

src-electron/handlers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ export function registerCallbacks (mainWindow, mainMenu, auth, git, lsp, tlm, te
358358
ipcMain.handle('saveValidationResults', async (ev, opts) => {
359359
const saveOpts = await dialog.showSaveDialog(mainWindow, {
360360
title: 'Save Validation Results As...',
361-
defaultPath: path.join(app.getPath('desktop'), 'results.txt'),
361+
defaultPath: opts.filePath || path.join(app.getPath('desktop'), 'results.txt'),
362362
filters: [{
363363
name: 'Plain Text',
364364
extensions: ['txt']

src/components/DrawerChecks.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,15 @@ function setCurrentCheck (key) {
312312
// Validation Results Output
313313
314314
async function saveResultsToFile (key) {
315-
if (await window.ipcBridge.saveValidationResults(editorStore.validationChecksDetails[key].getTextOutput())) {
315+
// -> Build file path from current document + key of the validation check
316+
let filePath = docsStore.activeDocument.path
317+
const extPosition = filePath.lastIndexOf('.')
318+
if (extPosition >= 0) {
319+
filePath = filePath.slice(0, extPosition)
320+
}
321+
filePath = `${filePath}-${key}.txt`
322+
323+
if (await window.ipcBridge.saveValidationResults(editorStore.validationChecksDetails[key].getTextOutput(), filePath)) {
316324
$q.notify({
317325
message: 'Results saved!',
318326
caption: 'Results have been saved to file successfully.',

0 commit comments

Comments
 (0)