The more time you spend with any program, the more you run into its limitations. If the program is customisable, the next step is obvious.
The (inevitable) end of the HomeSite era
About a year ago I abandoned my long term code editor HomeSite 1 in favour of Visual Studio Code 2. It was not a decision I made lightly, as HomeSite had served me well for over 20 years.
I had tried various alternatives from time to time3 and, while most of them were markedly better in some areas, I never found one that did all the things HomeSite did. In every case, switching seemed like a sideways step and didn’t seem worth the disruption.
A couple of years ago I noticed that HomeSite was starting to break in small ways, and I began to fear what would happen if – or, should I say, when – the day arrived that I would launch it and nothing would happen. Not only would I be stuck, I would also lose all the customisations I had made down the years. Time to make the transition while it was still feasible.
Transitioning away from a highly customised program
Anyone who has ever switched from a program they’ve used every day for many years to something completely new knows the pain of such transitions.
All the familiar commands and functions that have moved or been redesigned; all the memorised shortcuts you no longer have access to; maybe even some functionality that’s been completely lost.
If you have customised that program to exactly fit your workflow and your preferences, you run into another pain point. At best, you’re faced with the task of recreating all those customisations. But you might be unlucky and discover that, for all its benefits, the new program is not as customisable as the old one.
Customising Visual Studio Code
Thankfully that’s not the case with Visual Studio Code. Where HomeSite allowed you to create scripts that interacted with text and files, Visual Studio has a powerful API4 that allows you to create full-blown extensions, in fact many of its core features are built as extensions.
Migrating HomeSite scripts to Visual Studio Code
After spending some time getting used to Visual Studio’s interface, my first real project was figuring out how best to transfer all my HomeSite scripts into the new environment.
It was tempting to try to recreate them all as extensions, but an extension is more complicated than a script as it comprises at least three files, and must be built in compliance with strict rules and deployed following a set procedure.
Instead, it was more practical to convert them to Node.js scripts and to use a couple of third party extensions – Macro Commander 5 and Power Tools 6 – to hook them up.
It took several months, but I’ve migrated all of my most used HomeSite scripts to Visual Studio, and all of them are as good as or better than they were before – more fully featured, and easier to use, to debug, and to extend.
Some scripts are worth recreating as extensions
Once you’ve created your first script, it’s fairly easy to create others, as long as they’re simple. A script is a single JavaScript file, and you can often use an existing script as a starting point. You can also bundle what would otherwise be separate scripts by using command arguments and branching logic: in many cases I have combined several related HomeSite scripts into single Visual Studio script, which makes management a lot easier.
That said, there are some customisations that are naturally suited to creating as extensions rather than scripts. Tidy HTML and Recent Files (All) are two that I’ve created already. Smarter Comments is my latest.
Introducing Smarter Comments
Adding comments to scripts and HTML files is something every developer does every day, yet Visual Studio has very limited functionality to support this, just a single key combination that comments and uncomments the current selection in whatever comment style it decides is best for the current file.
In HomeSite I had a suite of scripts that added and removed comments in all the most commonly used styles. They were cumbersome – all those buttons and key combinations – but they worked well enough and earned their keep. Surely I could do something better in Visual Studio?

Smarter Comments 7 allows you to comment any selection in any of the most commonly used styles: HTML, C Multiline or Single Line, JSDoc, Perl, Visual Basic, and more. Its main strength is that it provides a single command that says “comment the selected text in the correct style for this file.” It surpasses the core behaviour in that it allows you to set defaults for all languages that have more than one commenting style. It complements this with a single uncomment command that recognises any comment style in any file.
/**
* Regular comment
*/
function double( n ) {
return n * 2; /* Trailing comment */
}
Additionally, it can handle trailing single line comments and, when uncommenting, will offer the option of just uncommenting them or deleting them outright.
Try It Out
If you use Visual Studio Code and you would like a flexible and comprehensive way of commenting and uncommenting all of your code files, please download my extension from the Marketplace and take it for a test drive.
Footnotes
- Macromedia HomeSite (Wikipedia)
- Visual Studio Code
- Sublime Text, Atom, one or two others I can't remember
- Visual Studio Extension API
- Visual Studio Marketplace: Macro Commander
- Visual Studio Marketplace: Power Tools
- Visual Studio Marketplace: Smarter Comments
