Get the Extension from the VS Marketplace.
Features
Features Inherited From AddAnyFile
- Easily create any file with any file extension
- Create files starting with a dot like
.gitignore
- Create deeper folder structures easily if required
- Create folders when the entered name ends with a
/
- Use
Shift+F2
keys to start creating a new file
Additional Features of FastNewFile
- Support for Visual Studio Templates (including custom templates)
- Customizable Pattern Matching for template selection
- e.g.
MyFile.cs
creates a C# Class,IMyFile.cs
creates a C# Interface,e:MyFile.cs
creates an empty C# code file. - Defaults the extension (somewhat intelligently) based on the project.
- e.g. On a C# project, the extension will default to
.cs
, on VB, it will default to.vb
. If you use a different extension twice consecutively, the extension then defaults to the 2nd extension. For example, on a project on which the default extension is.cs
, if you create two.ts
files consecutively, the nextAdd new file
prompt defaults to.ts
I will get in to detail of these features in future posts.
History
If you have used Mads Kristensen’s wildly popular Visual Studio extension called Add New File, you probably got hooked as quickly as I did. In fact, when I first installed VS Code on a Mac, the first extension I looked for was one that worked just like Mads one did [1].
But, the extension did miss one critical feature: It did not support the built-in or custom VisualStudio templates. Instead, it used a few hard coded templates. This has few drawbacks. Most obvious is that you will miss out on getting to use many of the useful templates if they are not already built in to the extension (or if you don’t rewrite them yourself). Apart from that, unlike the VS Templates, these hard coded templates cannot adapt to coding style settings such as using tabs vs spaces, tab widths, new line placement etc. So back in 2015, I implemented this feature and PR’d it as PR9.
As I had forked the original repo in implementing this feature, and that I had my own custom “version” of the extension my own custom “version” of the extension, while the PR was waiting to be merged, I went ahead and implemented few other features in it that I personally found useful. Ultimately, I kept using my own fork rather than switching to Mads’, even after the PR was merged. At some point, during a refactor of the original extension, the VS Templates support feature got removed and I was not following the repo to provide any assistance on getting it back. So, the original extension had evolved quite a bit without the original code, which makes it little difficult for me to go and re-implement it.
As I have now started using VS 2017, I needed to upgrade my old add-in. As I don’t plan to re-merge with the original code base, I decided to clean up my fork, and do a major refactoring. The Fast New File code base is the result of this.
[1] I found a few and ended up liking this one the most.
One thought on ““Fast New File” for Visual Studio 2017 is Available on VS Marketplace”