I waste a lot of time creating new files and complete paths for it, and I think there would be some good ideas to improve this.
For example, when using the "create new file" command (by right click or panel command):

VSC should be clever enough to understand that I request a complete path (existing or new) to put my file in, and create it all the way. A bit like the touch cli command.
Then again, a feature to automatically create a complete path to a file from a string would be great, like this (the example is from phpstorm) :

It would be great if it was possible like this, but even more if it could create the complete path directly.
Thanks!
@EmmanuelBeziat we actually used to support to create a file from a link path but looks like it got broken and I pushed a fix for it (https://github.com/Microsoft/vscode/issues/12896). This is how it should behave:

Your request for being able to enter paths in the file box is valid.
+10000 for making vscode smarter
If/when you do this - please also make sure it handles renaming/moving of the files in the same way : https://github.com/Microsoft/vscode/issues/9349
Thanks
@bpasero Your example work in the recent version of VScode, thanks!
Though I think it would be way more understandable (and easy-to-use) to have a "create file / create path and file" directly in the contextual menu, instead of having this sort of "error message that allows an action".
I still support my other idea to have a smart creation directly in the sidebar. Moreover, I agree with #9349 : this isn't about what is normal in a classic file exporer on desktop OS, but about what is standard in other code editors, and therefore to what dev are used to.
Anyway, great stuff for this recent update!
Hello. @bpasero thank you for your great work under new hotkeys for tree explorer. So there's one unclear moment for me. What command do I need to call to create file and nested folder at once for tree explorer? Currently I do this with
{
"key": "a",
"command": "explorer.newFile",
"when": "filesExplorerFocus"
}
but this does not create nested paths. So what is correct command for this?
@Aetet currently we do not allow you to type a path into the "New File" box and create folders directly, hence this feature is still open.
@bpasero is there any chance that it will go to March release?
It is not on our plan, but as usual we accept good quality PRs if anyone is interested. The input box for the explorer is created around here: https://github.com/Microsoft/vscode/blob/ben/next/src/vs/workbench/parts/files/browser/views/explorerViewer.ts#L302
@bpasero ok. Thanks. For other referencing this issue.
My workaround till this will be implemented:
https://github.com/dkundel/vscode-new-file
with following settings:
"newFile.showFullPath": false
And hotkey:
{
"key": "a",
"command": "extension.createNewFile",
"when": "filesExplorerFocus"
},
Yeah, I think using an extension for this is the best current workaround 馃憤
@bpasero wouldn't relaxing this check to accept (absolute and relative) paths rather than base paths fix the issue globally?
I'm used to this too, to move files around using the "rename" command.
Edit: one would also have to check that the target directory exists.
@isidorn @tsalinger isn't this done?
Yes it is ! :) Thanks !
Most helpful comment
@bpasero Your example work in the recent version of VScode, thanks!
Though I think it would be way more understandable (and easy-to-use) to have a "create file / create path and file" directly in the contextual menu, instead of having this sort of "error message that allows an action".
I still support my other idea to have a smart creation directly in the sidebar. Moreover, I agree with #9349 : this isn't about what is normal in a classic file exporer on desktop OS, but about what is standard in other code editors, and therefore to what dev are used to.
Anyway, great stuff for this recent update!