-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
feat(#2630): file renames can now create directories #2657
Conversation
Many thanks, I'll get to this on the weekend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please accept my apologies for not reviewing this earlier; this slipped off my list.
Unfortunately I'm not able to get anything working, including existing rename functionality, I think I'm Doing It Wrong. What OS / shell are you using?
Full rename testing using linux source:
-
CREDITS
->usr/CREDITS
-usr/CREDITS
directory created, file not moved -
Makefile
->usr/Makefile
- success reported, file not moved, should report: [NvimTree] Cannot rename Makefile -> Makefile: file already exists -
Makefile
->foo/Makefile
-foo/Makefile
directory created, file not moved -
README
->foo/bar/README
-foo/bar/README
created, file not moved -
README
->READMEEEE
- directoryREADMEEEE
created, file not moved -
usr/default_cpio_list
->usr/default_cpio_listtt
- directoryusr/default_cpio_listtt
created, file not moved
Events appear to be correctly sent.
idx = idx + 1 | ||
|
||
local p = utils.path_remove_trailing(path) | ||
if #path_to_create == 0 and vim.fn.has "win32" == 1 then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use utils.is_wsl
or utils.is_windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using wezterm terminal running zsh on macOS. I'll change the wsl, windows check on rename.
Should I change it in the create file because it is like what I've done right now?
I'll check into why this is failing :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using wezterm terminal running zsh on macOS. I'll change the wsl, windows check on rename. Should I change it in the create file because it is like what I've done right now? I'll check into why this is failing :)
My apologies, I didn't realise it came from copy. That's fine, no need to change.
We need a big refactor / abstraction for that functionality, but Not Today.
I'd be very grateful for a future PR to do that :)
…as the file and forgot to remove it
It's not fixed right now and shall reopen this PR after I've fixed the errors :) |
Hey no worries, take all the time you need. I look forward to using this functionality... |
…values as they were mismatched
Now the code does indeed work and has been tested. Not many changes have been made since the closing of this PR but now it seems to work at least on my device. My device: |
I've tested it on a vm and the functionality seems to be working VM: The renaming and directory creating functionality is working as intended and does not seem to create a directory instead of a file anymore |
Thanks for reopening. I'll get to review and test on the weekend. |
Looking good: Full rename
Rename
Rename basename
Rename omit filename
|
There was a problem hiding this 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!
I've implemented this feature.
I've just used the same code from create file as mentioned in the issue so as to not break any convention that was followed.
Any input is appreciated! :)