Create a new directory when a new file ends with `/`
This feature is present in almost all editors but in zed, doing so crashes the editor.
Release Notes:
- When creating new file via project panel, a filename ending with
/creates a directory.
We require contributors to sign our Contributor License Agreement, and we don't have @80avin on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.
@cla-bot check
The cla-bot has been summoned, and re-checked this pull request!
Worth noting vscode let's you create nested folders and optionally a file at the end, things like:
foo/barfoo/bar/foo/bar/bazand so on, which is a lot more complicated because it's ok for some prefix of the path to already exist. I think I actually found a vscode bug around this behavior, with in the folderfoo, it won't let you create the filefoo:But with the folder
fooand the filebarinside it, it won't show anything wrong creatingfoo/bar, but will fail to do so:Could always be added in future prs of course.
I think I actually found a vscode bug around this behavior, with in the folder
foo, it won't let you create the filefoo:
I think you are creating the file at same level as foo directory that's why this issue is coming.
To create a file inside a directory, you have to select the directory first. It'll look like this
But with the folder
fooand the filebarinside it, it won't show anything wrong creatingfoo/bar, but will fail to do so:
Noticed that in zed, even without this PR, it fails silently. We may need error for that but that can be separate PR.
I think you are creating the file at same level as
foodirectory that's why this issue is coming. To create a file inside a directory, you have to select the directory first.
It was intentional, I gave it as an example of what trying to create a duplicate file should do, rather than letting you create the file and get the filesystem error
