Add actions to remove and delete setting files

Signed-off-by: Sanjula Ganepola <sanjulagane@gmail.com>
This commit is contained in:
Sanjula Ganepola
2024-11-21 22:20:17 -05:00
parent db7972e887
commit c10f7109ac
11 changed files with 70 additions and 24 deletions

View File

@@ -48,7 +48,7 @@ export class HistoryManager {
for (const history of existingHistory) {
try {
await workspace.fs.delete(Uri.file(history.logPath));
} catch (error) { }
} catch (error: any) { }
}
this.workspaceHistory[workspaceFolder.uri.fsPath] = [];
@@ -60,7 +60,7 @@ export class HistoryManager {
try {
const document = await workspace.openTextDocument(history.logPath);
await window.showTextDocument(document);
} catch (error) {
} catch (error: any) {
window.showErrorMessage(`${history.name} #${history.count} log file not found`);
}
}
@@ -75,11 +75,13 @@ export class HistoryManager {
async remove(history: History) {
const historyIndex = this.workspaceHistory[history.commandArgs.path].findIndex(workspaceHistory => workspaceHistory.index === history.index);
this.workspaceHistory[history.commandArgs.path].splice(historyIndex, 1);
this.storageManager.update(StorageKey.WorkspaceHistory, this.workspaceHistory);
if (historyIndex > -1) {
this.workspaceHistory[history.commandArgs.path].splice(historyIndex, 1);
this.storageManager.update(StorageKey.WorkspaceHistory, this.workspaceHistory);
try {
await workspace.fs.delete(Uri.file(history.logPath));
} catch (error) { }
try {
await workspace.fs.delete(Uri.file(history.logPath));
} catch (error: any) { }
}
}
}