From bfd71458d0d1e08f30324f2e2b67243c803acc64 Mon Sep 17 00:00:00 2001 From: Davis Vaughan Date: Mon, 19 May 2025 13:45:50 -0400 Subject: [PATCH 1/2] Permadelete `.vdoc` temp files, bypassing the trash --- apps/vscode/src/vdoc/vdoc-tempfile.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/apps/vscode/src/vdoc/vdoc-tempfile.ts b/apps/vscode/src/vdoc/vdoc-tempfile.ts index 699df311..b016c258 100644 --- a/apps/vscode/src/vdoc/vdoc-tempfile.ts +++ b/apps/vscode/src/vdoc/vdoc-tempfile.ts @@ -75,12 +75,21 @@ export async function virtualDocUriFromTempFile( }; } -// delete a document +/** + * Delete a virtual document's on disk temporary file + * + * Since this is an ephemeral file, we bypass the trash (Trash on Mac, Recycle + * Bin on Windows) and permadelete it instead so our trash isn't cluttered with + * thousands of these files. This should also avoid issues with users on network + * drives, which don't necessarily have access to their Recycle Bin (#708). + * + * @param doc The `TextDocument` to delete + */ async function deleteDocument(doc: TextDocument) { try { - const edit = new WorkspaceEdit(); - edit.deleteFile(doc.uri); - await workspace.applyEdit(edit); + await workspace.fs.delete(doc.uri, { + useTrash: false + }); } catch (error) { const msg = error instanceof Error ? error.message : JSON.stringify(error); console.log(`Error removing vdoc at ${doc.fileName}: ${msg}`); From 6edf073aa2b14c012e4d02f123a76569d55e75a3 Mon Sep 17 00:00:00 2001 From: Davis Vaughan Date: Mon, 19 May 2025 13:50:55 -0400 Subject: [PATCH 2/2] CHANGELOG bullet --- apps/vscode/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/vscode/CHANGELOG.md b/apps/vscode/CHANGELOG.md index 11b8d824..55855367 100644 --- a/apps/vscode/CHANGELOG.md +++ b/apps/vscode/CHANGELOG.md @@ -2,6 +2,7 @@ ## 1.122.0 (unreleased) +- Language server temporary files are now permanently deleted, bypassing the trash can (). - Change controls on Positron editor action bar and fix "Render on Save" behavior (). ## 1.121.0 (Release on 2025-05-02)