vscode icon indicating copy to clipboard operation
vscode copied to clipboard

deleted files don't go to trash

Open frx08 opened this issue 1 year ago • 3 comments
trafficstars

Type: Bug

I delete files in the explorer using del key of keyboard, files are deleted and cannot be found in the trash bin

VS Code version: Code 1.95.2 (e8653663e8840adaf45af01eab5c627a5af81807, 2024-11-07T11:07:22.054Z) OS version: Linux x64 6.8.0-48-generic snap Modes:

System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i7-1365U (12 x 3700)
GPU Status 2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
webgpu: disabled_off
webnn: unavailable_software
Load (avg) 2, 2, 1
Memory (System) 31.00GB (22.61GB free)
Process Argv --no-sandbox --force-user-env --crash-reporter-id 8447ec3e-1827-4960-bb59-12316efae9e7
Screen Reader no
VM 0%
DESKTOP_SESSION ubuntu
XDG_CURRENT_DESKTOP Unity
XDG_SESSION_DESKTOP ubuntu
XDG_SESSION_TYPE wayland
Extensions (14)
Extension Author (truncated) Version
gitlens eam 15.6.3
ftp-simple hum 0.7.6
git-graph mhu 1.30.0
autopep8 ms- 2024.0.0
debugpy ms- 2024.12.0
python ms- 2024.18.1
vscode-pylance ms- 2024.11.1
jupyter ms- 2024.10.0
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.0.21
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
remote-containers ms- 0.388.0
LiveServer rit 5.7.9
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
pythongtdpath:30769146
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
bdiig495:31013172
dvdeprecation:31068756
dwnewjupyter:31046869
impr_priority:31102340
nativerepl2:31139839
refactort:31108082
pythonrstrctxt:31112756
cf971741:31144450
iacca1:31171482
notype1cf:31157160
5fd0e150:31155592
dwcopilot:31170013
j44ff735:31177056

frx08 avatar Nov 12 '24 07:11 frx08

Same problem here.

iamaakashbasnet avatar Nov 12 '24 11:11 iamaakashbasnet

Having this issue as well.

Version: 1.95.3 Commit: f1a4fb101478ce6ec82fe9627c43efbf9e98c813 Date: 2024-11-13T14:50:04.152Z Electron: 32.2.1 ElectronBuildId: 10427718 Chromium: 128.0.6613.186 Node.js: 20.18.0 V8: 12.8.374.38-electron.0 OS: Linux x64 6.8.0-48-generic snap

pdo5699 avatar Nov 18 '24 13:11 pdo5699

Can you safely delete these folders? It's currently eating up 35GB of space on my machine.

nlighteneddesign avatar Mar 07 '25 16:03 nlighteneddesign

Can you safely delete these folders? It's currently eating up 35GB of space on my machine.

You can find all the deleted file in /home/<username>/snap/code/current/.local/share . But this issue is solved now v1.97.2.

beemensameh avatar Mar 08 '25 11:03 beemensameh

Same issue, VS Code trash takes up significant space.

Ubuntu disk usage analyzer showing snap at 94.3 GB, vs code at 48.8 GB, and the vs code Trash using 44.1 GB.

There are files in there from 2 years ago. Holding onto files in the trash forever seems like a bug. (And as OP mentions, these files never end up in my OS's trash on Ubuntu)

Still occurring on v1.102.1

Christopher-Hayes avatar Aug 04 '25 19:08 Christopher-Hayes

Yes, my files are also in a directory as @beemensameh pointed out, but I'm not sure if that is the answer to this question. Is it still safe to delete those files? What was resolved in v1.97.2? Move to trash instead of vscode trash? Ability to clear these directories myself? I'm not sure, because I am running 1.104.1 as of right now. I probably don't need all of these files anyway, but I would like the answer to be as transparent and clear as possible. Also what does 'current' mean, because I have 2 directories 203 and 207:

Image

vljukap98 avatar Sep 29 '25 07:09 vljukap98

@vljukap98

Yes, you can safely delete all the files inside the Trash folder.

The current folder is a Snap thing. It's a link to the latest release of VS Code you have.

For example, on my system 200 is the latest release and current points to that folder.

Screenshot of console output showing the vs code snap folder. It shows a 198 folder and a 200 folder. There is also a current folder that points to the 200 folder.

From your screenshot, current should point to 207. The reason you also have 203 is because Snap by default holds onto one older version of the app. If VS Code 207 fails to start, Snap will automatically launch VS Code 203 instead. It also allows you to do things like run snap revert to immediately revert an app update.

If you're still low on space after clearing both Trash folders, you can also delete the 203 folder of your old VS Code app. It won't break anything since you're using 207.

Christopher-Hayes avatar Sep 29 '25 10:09 Christopher-Hayes

I also stumbled up on this issue while deleting large ai models I downloaded through VSCode. I assume this bug is specifically for VS code installed via Snap.

VS Code details

Version: 1.105.1 Commit: 7d842fb85a0275a4a8e4d7e040d2625abbf7f084 Date: 2025-10-14T22:33:36.618Z Electron: 37.6.0 ElectronBuildId: 12502201 Chromium: 138.0.7204.251 Node.js: 22.19.0 V8: 13.8.258.32-electron.0 OS: Linux x64 6.8.0-85-generic snap (Ubuntu 24.04 LTS)

Issues

  • VS code moves deleted files to ~/snap/code/<snap_code>/.local/share/Trash instead of Trash
  • Snap or vs code have no options like Empty Trash, Keep last 30 days data, or Delete large file permanently to manage this local trash.
  • When snap update vs code, the Trash content is also copied to new version's Trash folder. Which in turn accumulate trash data over many versions and a normal user could not use the system as disk volume get filled with garbage.

Findings

Snap set ~/snap/code/current to $HOME. So snap create a .local folder for each revisions of snap app. Those apps have to use personal-files interface to access them internally. There might be a possible fix within snapcraft.yaml file using plugs directive. But not very sure about it.

However, a much better fix could be a vs code tool that manage this local recycle bin for snap. But that would a low priority tool as it only affect snap users. Else we may have a develop 3rd party plugin or extension to resolve this as it is not directly related to vs code itself.

Conventional Fix

rm -rf ~/snap/code/[0-9]*/.local/share/Trash/{files,info}/{*,.*}

This will delete everything inside snap code Trash files in all version. With that said, I think this issue can be closed.

nikhiljohn10 avatar Oct 18 '25 06:10 nikhiljohn10