zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
49.21k stars 2.98k forks source link

Project Panel Rename: better error validation, support nested slashes #18784

Open htor opened 3 weeks ago

htor commented 3 weeks ago

Check for existing issues

Describe the feature

When trying to rename a directory in the left dock and inserting a slash (/) into the new name I get a dialog telling me:

Error renaming <x> into <y>: Invalid argument. (os error 22)

Screenshot 2024-10-06 at 13 16 10

I was curious to know if I could create a subdirectory by just renaming the current directory and adding another slash in the name. Creating nested empty directories by slashes seems to work fine though: a/b/c works like mkdir -p a/b/c which is neat.

If applicable, add mockups / screenshots to help present your vision of the feature

Maybe it would be more informative to say what characters are considered invalid in directories (for this OS)? Something along the lines of:

Error renaming ... Directory names cannot contain: /, \, <, etc

notpeter commented 3 weeks ago

I see this as two requests:

  1. Support mkdir -p directory renaming
  2. Better validation / custom error message for renaming files/folders.

MacOS/Linux Prohibited chars: /, the NULL byte (ASCII 000) MacOS/Linux Prohibited names: .., . Windows Prohibited chars: <>:"/\|?* + ASCII 000-031 (control characters)