microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.13k stars 29.27k forks source link

Deleted files move to another directory, not to trash #174722

Open reichd opened 1 year ago

reichd commented 1 year ago

Type: Bug

When I delete a file or folder from within Visual Studio Code, the file goes to my OneDrive folder (directly inside my user $HOME directory), instead of the trash.

VS Code version: Code 1.75.1 (Universal) (441438abd1ac652551dbe4d408dfcec8a499b8bf, 2023-02-08T21:34:59.000Z) OS version: Darwin x64 22.2.0 Modes: Sandboxed: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz (16 x 2400)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|2, 2, 2| |Memory (System)|32.00GB (6.47GB free)| |Process Argv|--crash-reporter-id 3b19382d-0a1f-4827-a921-45a9b4eca74b| |Screen Reader|yes| |VM|0%|
Extensions: none
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vstes627:30244334 vslsvsres303:30308271 pythonvspyl392:30443607 vserr242:30382549 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 pythondataviewer:30285071 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593cf:30376535 pythonvs932:30410667 cppdebug:30492333 vscaac:30438847 vsclangdc:30486549 c4g48928:30535728 dsvsc012:30540252 azure-dev_surveyone:30548225 pyindex848:30662994 nodejswelcome1:30587005 2e4cg342:30602488 pyind779cf:30662993 89544117:30613380 pythonsymbol12:30657548 vscodedisable:30660115 ```
IllusionMH commented 1 year ago

Are these files originally in OneDrive or in your regular folders on disk?

reichd commented 1 year ago

The files are on my filesystem within the OneDrive folder. Specifically they are at /Users/daniel.reich/OneDrive/Research.

lramos15 commented 1 year ago

@bpasero We just use the native recycle bin here.

bpasero commented 1 year ago

We use Electron, so the issue (if at all) is upstream: https://github.com/electron/electron/blob/19-x-y/docs/api/shell.md#shelltrashitempath

minghaoguo20 commented 1 year ago

I also get this problem. All the files I delete in vs code(right click to delete) are not moved to the recycle bin. instead, they are actually moved to the root of my onedrive file. (My codes are in /Users/MYNAME/Library/CloudStorage/OneDrive-zju.edu.cn/code/ and the deleted file are in /Users/MYNAME/Library/CloudStorage/OneDrive-zju.edu.cn/) My vs code version: Version: 1.75.1 (Universal) Commit: Date: 2023-02-08T21:34:59.000Z (1 wk ago) Electron: 19.1.9 Chromium: 102.0.5005.194 Node.js: 16.14.2 V8: 10.2.154.23-electron.0 OS: Darwin arm64 22.2.0 Sandboxed: No (I'm using Macbook Air M2 )

TerryF7 commented 1 year ago

same problem When I delete my files in OneDrive with vs code(right click and shortcut), all files moved to the root directory of OneDrive instead of recycle bin. My vscode version: Version: 1.75.1 (Universal) Date: 2023-02-08T21:34:59.000Z Electron: 19.1.9 Chromium: 102.0.5005.194 Node.js: 16.14.2 V8: 10.2.154.23-electron.0 OS: Darwin arm64 22.3.0 Sandboxed: Yes M1 Pro Macbook Pro

garyking commented 1 year ago

I've got a similar problem, as I posted at #177427, but it affects Dropbox. If I delete a file within ~/Library/CloudStorage/Dropbox in a VSC workspace, then it bypasses the Mac Trash.

david-leconte commented 1 year ago

Similar problem here

Version: 1.77.3 Commit: 704ed70d4fd1c6bd6342c436f1ede30d1cff4710 Date: 2023-04-12T09:19:37.325Z (1 wk ago) Electron: 19.1.11 Chromium: 102.0.5005.196 Node.js: 16.14.2 V8: 10.2.154.26-electron.0 OS: Darwin x64 22.4.0 Sandboxed: No

M1 Macbook Air

ofiryaish commented 1 year ago

Same problem here with MacOS. Very annoying. It moves all the files to the One Drive folder instead of the OS trash.

huudi commented 1 year ago

Also having this issue with One Drive. If I delete directly in the finder it works okay but via VS Code it goes to the root of OneDrive.

Has a solution been found yet?!

Shurikal commented 1 year ago

It is a problem with electron. I created a small app to test it. When the project is started inside a OneDrive folder, the deleted file goes to the root folder of OneDrive.

I opened an issue on the electron site.

ghost commented 1 year ago

This is still a problem, I thought it's something wrong with my configuration but it appears not, it never used to happen.

I found a workaround (not ideal though) is to disable: files: enable trash in VSCode.

rzhao271 commented 1 year ago

Upstream has reported it as a OneDrive issue, ref https://github.com/electron/electron/issues/38541#issuecomment-1584278194.

Does the issue only occur with VS Code (or another Electron application) and not Finder?

Shurikal commented 1 year ago

The problem occurs in every Electron application. I explained it here: https://github.com/electron/electron/issues/38541#issuecomment-1573934608 As mentioned, it is a problem with the OneDrive implementation.

gernophil commented 1 year ago

I think, this issue is also happening for me. I was wondering about the huge amount of file piling up in my OneDrive root folder. Thought it happens when copying, but maybe it's happening, when I delete files. It's really annoying.

jeanlescure commented 1 year ago

Given Electron's feedback on this issue:

This is a bug in OneDrive implementation, the API Electron is calling is correct but OneDrive clearly isn't handling it correctly 😅 I'd suggest reporting this bug to OneDrive / msft support as it's something that their app can fix but Electron can / should not.

someone from VSCode team should reach out to someone at OneDrive team since both are Microsoft.

This issue is affecting users of these Microsoft solutions.

gernophil commented 1 year ago

Has there been any change on VSCode's or OneDrive's side? Since some days deleting files located on OneDrive via VSCode takes ages.