Create non-existent files using VS Code
Here’s a handy trick I recently discovered in VS Code that allows you to create non-existent files using the editor itself.
Essentially, when you try to open a file that doesn’t exist, VS Code will prompt you to create it. You can do this by clicking on the
So, for instance, if you are trying to open a file named
js/bar/foo.js (in a
<script> tag) using Ctrl / Cmd + Click and if it doesn’t exist, it will prompt you to create it. And from there, it will automatically create the file for you.
Here’s it in action.
This will also create directories if they don’t exist. I think it’s pretty handy and saves you from having to create files manually.