Visual Studio is great, Visual Studio 2008 Standard Edition is my favourite iteration so far and the best IDE I’ve had the pleasure of using. I sometimes think that the only reason I don’t stray into Java and PHP is because it’d mean giving up Visual Studio. I cannot state this strongly enough, Visual Studio is great.
There is always room for improvement however, and in this post I am suggesting a workaround to make working with JavaScript and CSS a bit easier.
When working with C#, VB, (X)HTML, XML, etc… in VS2008 you have a number of ways to make large files more manageable. XML tags are collapsible, as are C# and VB methods and classes. You can also create collapsible regions to group collapsible objects together. There are drop down lists and class views for jumping to specific objects and sections. There are a lot of sign posts in VS to prevent you from getting lost.
Unfortunately, none of this exists for JavaScript and only a limited amount for CSS. Especially unfortunate as both of these file types can become quickly unwieldy. It is tempting to split JavaScript files into smaller more manageable files, using jQuery plugins as an example. But when your trying to keep HTTP Requests to minimum, recombining JavaScript files can be laborious. The situation with CSS files is less dire because of the class view, but a big web site usually means big CSS files and the class view doesn’t always cut it for me.
My tip is quite an obvious one, I can’t believe it has taken me so long to work it out. The tip is bookmarks, I know clue in the title. By chopping up your code into logical sections and assigning each of those sections a bookmark, large files become a great deal easier to navigate. I told you it was obvious, I’ve been using bookmarks since Word ‘97.
Adjusting the environment to my requirements was straight forward. I’ve given up trying customise keyboard shortcuts, there just too many. I hate chords! So, my first step was to create a new toolbar (called Bookmarks). In the newly created toolbar I placed three buttons from the Edit menu, “Enable Bookmark”, “Prev Bookmark in Doc” and “Next Bookmark in Doc”. The first toggles the bookmark on or off at any given location, the second two allow me to navigate my JavaScript and CSS files a lot more efficiently.
That’s it, sorry if it’s a bit anticlimactic, but it has really sped things up for me.
