This is the 32nd in our series of guest posts by Microsoft Most Valued Professionals (MVPs). You can click the “MVPs” tag in the right column of our blog to see all the articles.
Since the early 1990s, Microsoft has recognized technology champions around the world with the MVP Award. MVPs freely share their knowledge, real-world experience, and impartial and objective feedback to help people enhance the way they use technology. Of the millions of individuals who participate in technology communities, around 4,000 are recognized as Microsoft MVPs. You can read more original MVP-authored content on the Microsoft MVP Award Program Blog.
This post is by ASP.NET/IIS MVP James Chambers Thanks, James!
Script References in Visual Studio 2013
A Little Background on IntelliSense
IntelliSense has been featured for nearly two decades now in Visual Studio’s lineage, dating back to 1996. Developers have become so accustomed to using it that when you spend any time in a different development environment you immediately feel impaired.
IntelliSense is great for learning APIs, object exploration and, when used well, can dramatically speed up the time it takes to write code. It also has the nice side benefit of allowing us to write appropriate and descriptive property and method names without having to worry about how long it would take later to access those members by typing them out L-E-T-T-E-R-B-Y-L-E-T-T-E-R.
When feature phones started introducing autocomplete, I was like, “Pfft! I’ve had autocomplete for years!”
So what was left for Visual Studio 2013?
I’m So Glad You Asked – Let’s Auto-Sync Up on That
Getting to this point took some time, but it was worth the wait. Even without having extensive documentation on our libraries, Visual Studio was able to offer us a great IntelliSense experience and afford us many luxuries to accommodate our work style. But this post isn’t about IntelliSense directly, it’s about how Visual Studio has gotten even smarter in how it keeps IntelliSense in sync.
The first way they improved on this in Visual Studio 2013 was with the “auto-sync” feature of the _references.js file, as you see activated in Figure 2.
Auto-sync keeps your _references.js file up-to-date as you move files around or rename the scripts you write. For example, if I move my shapes script by dragging and dropping it into a StyleFramework directory, the result is what you see in Figure 3. The reference is automatically updated with the new file location.
Not a One Trick Pony
At first glance this is convenient, but auto-sync doesn’t stop there. The feature is aware of your project’s dependent packages, so as you install or upgrade packages, your _references.js file is kept up to date as well. Check out what happens to the file name (notice the version) after I upgrade my jQuery package to the latest version, illustrated in Figure 4.
Whoa! Little code ninjas from programming heaven have saved you from disappearing IntelliSense! Without that version update, you’d lose your dot-completion; with it, well, it’s a thing of beauty.
For Those of You Just Tuning In
James Chambers is a husband, father, speaker, author and Senior Software Developer in Canada, where he once made a snowblower out of three electric toothbrushes, a shovel and duct tape, all while fighting off an angry pack of polar bears. His development passions are fueled by new tech, new tools and mentoring others. Outside of geeking, James is driven to help find a cure for Juvenile Diabetes, ensure children world-wide have access to clean drinking water and to find ways to better distribute the world’s food supply. Follow his coding adventures and other exploits at http://jameschambers.com.