Skip to content

feat(trash): add synchronized trash support for windows #2335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

linrongbin16
Copy link
Contributor

@linrongbin16 linrongbin16 commented Jul 23, 2023

fixes #2331

Support trash-cli on Windows, relate to discussion #2333 and #2331.

  1. remove Unix only from trash action.
  2. set detach=false and jobwait { job } on Windows to make trash operation sync on Windows. This is because: in my testing/practicing, when set detach=true in jobstart, nvim (running in Windows Terminal app) quickly switch to desktop, then switch back to nvim, that makes the screen blink. I guess the process detech behaviour is different under Windows, to avoid this blink I set sync wait under Windows.
  3. manual tested on Windows 10 x86_64, nvim v0.9.1, latest nvim-tree master.

@linrongbin16
Copy link
Contributor Author

linrongbin16 commented Jul 23, 2023

or maybe just leave the detach=true because it seems this is a OS level difference?
or maybe add 1 config option so leave detach option to user?

Hi @alex-courtis , do you have any comments ?

@linrongbin16 linrongbin16 marked this pull request as draft July 23, 2023 09:36
@linrongbin16 linrongbin16 marked this pull request as ready for review July 23, 2023 10:36
Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good.

I'm happy with the sync: cautious but reliable behaviour is preferred. We don't need any more options.

What is the actual trash.cmd? We can set this for windows, as I have just done for macos: #2336
It might be easiest to merge that PR before this one.

Please:

  • update help section 10
  • update help section 4 nvim-tree.trash.cmd
  • test under WSL and powershell (if you haven't already)

@linrongbin16
Copy link
Contributor Author

linrongbin16 commented Jul 24, 2023

hi @alex-courtis ,

The actual trash.cmd is trash (see https://github.com/sindresorhus/trash-cli), the two implementations (python and nodejs) use the same cmd name trash.

-------- update --------

Add manual testing screen recording here (Windows 11 arm64 VM running on macOS M1, the trash operation seems very slow but it should the VM performance issue, not nvim-tree or other things):

test-on-windows11-v1.mp4

I had done 2 kinds of manual testing:

  1. Windows 10 x86_64 + powershell/command prompt, when I first submit this PR (at my home PC).
  2. Windows 11 arm64 (a parallel VM running in macOS M1) + windows command prompt (cmd), tested at my macOS M1 macbook pro.

Tasks:

  1. update help section 10
  2. update help section 4 nvim-tree.trash.cmd
  3. test under both powershell and windows command prompt.
  4. test under WSL. -- Is this WSL or WSL2? I don't have WSL on my Windows 10 or Windows 11, because it's quite legacy, I only have WSL2, which is actually a ubuntu VM running on Windows 10 host.

@alex-courtis
Copy link
Member

4. [ ]  test under WSL. -- Is this [WSL](https://learn.microsoft.com/en-us/windows/wsl/install#upgrade-version-from-wsl-1-to-wsl-2) or WSL2? I don't have WSL on my Windows 10 or Windows 11, because it's quite legacy, I only have WSL2, which is actually a ubuntu VM running on Windows 10 host.

RE WSL or WSL2 I'll leave that to you... I'm not familiar with windows.

A quick test on whatever is the current WSL would be great.

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, many thanks for your contribution.

@linrongbin16
Copy link
Contributor Author

A quick test on whatever is the current WSL would be great.

Test on WSL2 is done.

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for your contribution!

@alex-courtis alex-courtis changed the title feat(trash): support trash-cli on windows feat(trash): add synchronized trash support for windows Jul 29, 2023
@alex-courtis alex-courtis merged commit 75c0574 into nvim-tree:master Jul 29, 2023
@linrongbin16 linrongbin16 deleted the linrongbin16/support-trash-on-windows branch July 29, 2023 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trash files on Windows as well as Unix system
2 participants