Improving client-side development in Visual Studio
ASP.NET, CSS, JavaScript By Dave Ward. Updated July 28, 2010For several years now, I have been consistently impressed with how Microsoft’s developer division gathers feedback and proactively responds. Nearly every time that I’ve participated in a survey or otherwise provided feedback (solicited or not), someone has followed up with me about my specific concerns. In my experience with how other large companies gather feedback, that’s not common.
So, when I answered a recent survey about ASP.NET development in Visual Studio 2010, I wasn’t surprised when I received a follow-up email from a friendly fellow at Microsoft named Xinyang. In the optional comments section, I had mentioned my concern that CSS and JavaScript editing are becoming second class citizens in Visual Studio. In response, Xinyang asked me to provide more detail on that comment.
As I composed a lengthy email reply to him, it occurred to me that a post here would be a much more effective way to refine my feedback and potentially gather more responses from you at the same time.
So, here are a few of my ideas for improving client-side development in Visual Studio 2010, separated into CSS and JavaScript specific feedback. Xinyang and some of his colleagues will be reading this and your comments, so if you agree, disagree, or have other ideas yourself, be sure to chime in.
CSS
Visual Studio 2010’s CSS editing experience is workable, but that’s about the best I can say about it. There aren’t any bugs that I’ve encountered, per se, but it’s Spartan.
I think a few simple features could improve the CSS editing experience dramatically.
Working with color
Displaying color swatches along with CSS color codes is a handy feature that’s been filtering into development editors lately. Whether the swatch is displayed in that line’s margin or elsewhere, having a visual representation of RGB and hex color codes is helpful.
This is how JetBrains’ WebStorm handles that, for example:

Taking that a step further, it would be great if clicking those color swatches would open a color picker. I’ve been using the Firepicker addon to Firebug to achieve similar functionality in-browser for several months now. Try it; you won’t know how you lived without it before.
I haven’t had an opportunity to try it myself yet, but DevExpress’s CodeRush apparently includes an implementation of both those features in the meantime.
Property ordering
Alphabetically sorting CSS properties is considered a best practice by many (including myself), but it’s tedious to manually rearrange properties that fall out of order. It would be great if formatting the document could automate that task, so that this:
.myCssClass { margin: 0 auto; border: 1px solid #000; width: 960px; height: 42px; }
Would become this after formatting:
.myCssClass { border: 1px solid #000; height: 42px; margin: 0 auto; width: 960px; }
Condensing properties
Similar to property ordering, I’d like to see the editor automatically condense overly verbose style definitions. For example, this:
div { border: 1px 1px 1px 1px solid #000; margin-top: 0; margin-left: auto; margin-right: auto; margin-bottom: 0; }
Could be condensed, without changing its effect, to this:
div { border: 1px solid #000; margin: 0 auto; }
Respect existing formatting
One thing that nearly CSS editor I’ve used has failed at is respecting existing formatting choices. For example, if a style only includes a single attribute, I usually prefer to use the most compact syntax:
a:hover { color: #444; }
The one-liner is just as readable as the three or four line alternatives, but takes up much less space on the page.
However, once there are several attributes, I prefer to expand the declaration:
a { color: #333; display: inline; text-decoration: underline; }
Currently, if I’ve mixed those two formats in the same file, I must avoid allowing the document to be formatting, because it will homogenize the formatting.
Even better would be if I could set a threshold. Styles with less attributes than the threshold would use “compact” formatting and the rest would use “semi-expanded” formatting.
Respect hierarchical indenting
In the same vein as respecting my formatting choices, it would be great if formatting a CSS document would avoid discarding my indentation choices. Indenting CSS declarations based on their “depth” is a great way to improve the readability of CSS, but is unfortunately something that most CSS editors don’t play nice with.
For example, if I have this CSS:
#Container { … } #Container a { … } #Container a span { … } #Container a strong { … }
Visual Studio will flatten it any time the document (or that section) is formatted:
#Container { … } #Container a { … } #Container a span { … } #Container a strong { … }
It would be a great relief if the editor would respect my indentation choices. Currently, my CSS editing experience is overshadowed by the fear of an accidental Format Document.
This would be especially important if alphabetizing properties were added to the automatic formatting. I would ideally like to apply that feature to an entire document or large selection, but couldn’t if it would flatten the document’s indenting at the same time.
Automate hierarchical indenting
While we’re at it, respecting manual indent levels would be nice, but it would be even better if the editor could infer and automate that indenting. For example, let me throw this CSS at it:
#Content { … } #Content a { … } #Content a span { … } #Content blockquote { … }
And have it format it like this:
#Content { … } #Content a { … } #Content a span { … } #Content blockquote { … }
I don’t know how feasible it is to implement that as a general solution, but it would be a phenomenal addition if possible.
JavaScript
These days, I spend at least as much time editing JavaScript as I do editing C#. As the Microsoft <3 jQuery story continues to unfold, I think (hope!) that this will also be the case for an increasing number of other developers using Visual Studio.
However, the JavaScript editor needs some work before it pays proper respect to the growing importance of JavaScript in modern ASP.NET development.
Automatic outlining
If you aren’t familiar with the term, this MSDN page describes outlining in Visual Studio. Automatic outlining is the experience you’re used to in most of the files that Visual Studio edits, like C# and VB.NET, where conditional and structural blocks automatically have outlining applied to them when you open a file.
In Visual Studio 2008, editing a JavaScript file looked like this:

It didn’t have automatic JavaScript outlining, but the hard left margin made the lack of outlines less noticeable.
Here’s the same file in Visual Studio 2010:

Notice how the lack of outlining translates to a lack of a hard left margin in Visual Studio 2010. That’s tough to deal with. At a glance, my code is lost at sea, visually unmoored from the line beginnings at the left.
Looking at how other JavaScript editors display that same code puts this deficiency in stark contrast. Here’s how Notepad++ handles it, for example:

Beyond the obvious outlining in the left margin, I really like how it also drops vertical guidelines directly below each logical block. In fact, Notepad++ strikes an almost perfect balance between visual utility and distracting over-embellishment.
For another perspective, here’s the same code in JetBrains’ WebStorm:

WebStorm’s default may take this all a bit too far by outlining, highlighting, and otherwise accentuating so many different elements of the code. Emphasizing so much of the code diminishes the effect of each individual display hint.
On the bright side, there’s a Visual Studio 2010 extension that adds basic outlining to JavaScript files: JSEnhancements. I’ve been using it for a couple weeks now and it does make a big difference.
Something this basic really should be built-in though. Too many developers will needlessly struggle with this deficiency and never know about the extension (or not be allowed to install it).
Object literal outlining
In addition to offering outlining for logical blocks of code, it might also be helpful to include outlining to condense JavaScript object literals. Common as they are in any jQuery work, support for automatically outlining them may prove useful.
Something like this:

I’m on the fence about the real-world utility of this one, but decided to throw it out there anyway. What do you think?
JavaScript code navigation
The lack of code navigation in and across JavaScript files leaves a lot of room for improvement. I’ve already spent enough time hitting CTRL-F in JavaScript files to last a lifetime.
Probably the most glaring omission is “Go To Definition”, but it’s also a shame that Visual Studio 2010’s fancy new “Navigate To” feature also overlooks JavaScript files.
There’s not a lot to say about this one. What’s missing should be obvious, and it’s a very painful omission for those of us working heavily on the client-side. Improvements will be welcomed.
Parenthesis spacing
Visual Studio 2010 introduced one new formatting behavior that I really don’t understand: a forced space between the function keyword and its opening parenthesis.
For example:
// This: function foo() { … } // Becomes this: function foo () { … } // This: function() { … } // Becomes this: function () { … }
I tried in vain to manually fight against that automatic formatting at first, but eventually gave up. The automatic formatting was being invoked too frequently for me to keep up with it.
Until Visual Studio 2010 started formatting my code that way, I can’t remember having ever seen that style of spacing in JavaScript function declarations. Whatever the motivation for this change, the kicker is that the new behavior isn’t even optional.
Please fix.
Intellisense
I like the idea of JavaScript Intellisense to some extent. The jQuery VSDoc files are a good example of JavaScript code completion that really does offer enhanced discoverability and increased productivity.
However, I’m concerned that the editor is lacking basic features like code navigation because too much effort is being spent on the unattainable goal of perfect code completion in a dynamic language. I hope I’m wrong about that, but it bears mentioning.
As you get acclimated to JavaScript, Intellisense for your own code really isn’t necessary. It can be neat when it works, but fails often enough that you learn not to count on it. Worse, you eventually learn not to trust it.
That’s not so bad anyway. The JavaScript language is not large or complicated; in fact, Crockford boiled it down to the “Good Parts” in less than 150 pages. There is much less need for comprehensive Intellisense when working with a smaller language.
JavaScript Intellisense on external APIs is where Intellisense really shines. Trying to infer what “this” refers to in the anonymous function callback I just wrote? Not so much.
Your turn – Leave a comment with your feedback
People in the position to make these sort of suggestions a reality are reading this and I believe they’re eager to hear your feedback. If you’ve been using Visual Studio 2010 for ASP.NET development, this is a great time to provide constructive criticism and/or your ideas for improvements early enough to make it into 2010 SP1 or v.Next.
Update: When writing this, I assumed that any of these formatting features would be optional if implemented. Just a few more checkboxes in Options > Text Editor > CSS|JS > Formatting.
Considering one of my points in this post was that my paren-spacing cheese got moved without an option to fix it, I probably should have been more clear about that. So to be clear, any of these ideas should only be added as an optional formatting choice, not something that’s forced.
Similar posts
What do you think?
I appreciate all of your comments, but please try to stay on topic. If you have a question unrelated to this post, I recommend posting on the ASP.NET forums or Stack Overflow instead.
If you're replying to another comment, use the threading feature by clicking "Reply to this comment" before submitting your own.



Personally I love the way that cntrl k+d, or cntrl k+f works on commenting HTML and other code regions. Why can’t this work when editing CSS files? Seems like a no brainer.
That’s a good point; I hadn’t noticed that was missing.
The most lacking feature, IMHO, is the JavaScript intellisense. Not being able to go to a function’s definition kills productivity.
I also agree with James’ note about commenting in CSS files being needed.
Regarding the parenthesis spacing, I agree that it should be configurable. But more than that, there should be a lot more JavaScript formatting configuration in general. I always have to turn off JavaScript formatting altogether because I can’t get Visual Studio to respect my style preferences.
Thanks Dave!!! I have been shouting the same things and maybe more need to be updated to make VS work in the modern web/AJAX world better. The ability to hit F12 to go to a function definition would save me 1-2 hours a day right now.
Ditto on all the JavaScript changes mentioned in this post.
The color chip popup needs to happen immediately and the more robust it is, the better (think colourlovers.com’s palette creation tools).
I can’t get behind the CSS property ordering or indenting, though. I prefer to organize my properties in logical groups, often with more than one property per line (almost like CSS sentences). While I think the editor should respect your indentation levels, I think having it auto-indent would need to be configurable (on/off). I much prefer the hierarchical layout of the first code example to the second.
Hi Dave, thaks for the wonderful feedback. I work with Xinyang and I wanted everyone to know thatm like you said, we would (and are) watching this post. A lot of the comments you have mentioned have been brought up previously, so you’ve got some really good ideas! Keep them coming.
Thanks,
Sayed Ibrahim Hashimi
Those additions would be great. It seems sometimes that Javascriptt lost it’s first class status in the .net arena. Jscript is being decommissioned, no js doc generator (I’m going to have to use natural docs), and no code navigation. I hope they implement your suggestions. I use notepad++ more than VS for my js work.
Funny, I was just talking to a co-worker about JS Doc Generators 30 minutes before your message :)
I agree Javascript outlining / regions would be helpful. Goto Deffinition would be nice too.
The color idea for CSS is interesting but what do you do when you have BG color, regular color, border color, etc. It can be a lot if its all in the magin.
I don’t think I would like the idea of sorting and reformatting css though. I like to place each rule on a single line w/ no indent.
It would be nice to have regions in CSS via some type of comment syntax.
G’day Dave, great list! I totally agree that as an ASP.NET developer working 8 hours a day in Visual Studio, CSS and JavaScript support have gotten little love in the last couple of versions of VS.
I do have a comment on your views on re-writing CSS (or any other sort) of code. Visual Studio in general does not re-write code. For instance, the “Using” statement in Visual Basic is the recommended way to create an object, do something with it and then clean up as opposed to a try/catch/finally block. However VS would never rewrite code that could potentially use a “Using”.
There’s other examples too (I’m sure you could think of a few). Maybe suggestions like these can be incorporated into code analysis/FxCop, which in itself is not that useful as not all developers use it (on a side note, I can just see Clippy popping up with “Would you like me to automatically indent your CSS hierarchies?”)
Getting back to CSS, I have a preference for formatting too but other developers on the same project might not share my views. Additionally, the format, order and condensing “overly verbose style definitions” (which I totally agree with) might be better suited to a post-build step which packs and optimises CSS (e.g. YUI Compressor, Dean Edwards’ Packer.NET).
I don’t have any solutions, but one thing I did read about with interest was http://lesscss.org/ which moves CSS to almost being “compiled”. You build the rules using variables and macros, it outputs the CSS. While this doesn’t directly address your formatting issues, it goes some way to making them less relevant if the tool would output optimised, “production” CSS (no white-space or comments).
Well done to the VS team for getting feedback on these features too. I look forward to what can be done in the future!
Cheers, Thomas
I do like the ordering of elements. What I’d really like is functionality similar to Stylizer, where I can have a properties window when viewing the design view of a user control or form and editing the CSS there will show me the results immediately on screen. I know a lot of people won’t be a fan of this, but as a developer with only minimal design experience and where I usually tweak someone elses design, this is a great feature.
As for the color display in the CSS, I’d really recommend something more along the lines of how DevExpress CodeRush now does it. They show the color as a 2 pixel line beneath the color specification. This would solve the problem of having a background with multiple colors specified.
Thanks,
Tom
(reposting for better formatting)
For CSS I would love to see a color picker as well.
But for my money, the best features to improve productivity would be in the area of JavaScript. I am finding the ratio of client side vs server side coding beginning to weigh more heavily towards client side jQuery/AJAX. That said, here’s my wish list:
- Better JavaScript Intellisense overall
- Recognition JSON style object properties, methods in Intellisense
- Better intellisense recognition of variable scope, particularly in module and singleton patterns
- An absolute MUST HAVE, already mentioned here, would be the ability to go to an object definition, as well as to “find all references” via a right-click context menu.
- Including jsLint style JavaScript code checking
- Include a JS “compiler” that catches errors before the page is ever loaded
Dave — FWIW, many of your CSS suggestions are simply based on coding style preferences, not productivity improvement. I would not want a particular coding style pushed upon me (“heirarchical indenting” of CSS would piss me off to no end). I would also caution against automatic ordering of styles in the case that one attribute may need to precede or override another in order for a particular style to work (say, for specific browsers).
Thats a nice post.
I too miss a couple of features still in Visual Studio
CSS
—-
a. No hot-key for commenting the css-codes, though we have one for js and html commenting
b. color-preview suggested above is an awesome idea. even, i miss that feature in IE8 Developer Toolbar too
JavaScript
————–
a. Intellisense is getting better and better on each version of VS. And, I’m sure that get even better in next release
b. The imortant thing what I miss in JS is – an expand/collapse node for javascript functions similar to what we have in code-behind file.
c. also, a crazy idea. still don’t know whether is possible or not. Suppose I’m refreing a server-control using ”, i needto write the js-code in the same html page itself. It will be nice if I can do that in a seperate JS file; by providing some mechanism (in the js-file) to refer the ‘ServerControlID’
I guess, thats what I’ve.
Thanks fo this wonderful post.
:)
You didn’t mention the “JS Enhancements” extension in VS2010 that gives us the missing outlining and even regions. I’ve started using VS2010 for my JS now that I have that extension when I was using Notepad++ before.
There’s a link to JSEnhancements at the end of the outlining section. I don’t think just an extension is enough though, because so many VS10 users won’t ever know about it or aren’t allowed to install extensions where they work.
It’s definitely nice to have for now though.
I agree; nice for now, but really should be in the product itself. Sorry I missed the link. I did a textual search with a space [blush] after skip-reading the article for the highlights [double blush].
I don’t agree with the formatting, everybody has different coding rules. In css, alphabetical property ordering works for you, i like to order by type.
The auto shorthand would be nice, but what if an expanded version is exactly what you want?
I think VS formatting is great as is.
If VS would do all these things, it would mean you would have to change your coding rules or make VS take on yours. Not to mention there are so many preferences you would want to set. Adding exceptions etc..
For the outlining of JS, there is an extension for VS2010 that does exactly this: JS Enhancements! Very usefull. Only thing i’m still missing is the vertical outlines..
The best addition i’d like to have in VS is the color picker.
Another thing i’m thinking of: css/js minification on publish!
Great post and great ideas. I really hope we will see some of this soon.
+1 for some sort of jslint implementation. Also, wouldn’t it make sense to align the default JavaScript formatting to the standard JavaScript formatting. It should be customizable but it would be great if it would line up with ANY of the Crockford standards.
Regarding difference of opinion on formatting: any formatting features should definitely be optional, not forced (as seen with the paren spacing issue). These should just be a few more options added to Options > Text Editor > CSS|JS > Formatting.
In the case of condensing CSS properties, maybe it would make sense to add that as separate function in Edit > Advanced, where you could more selectively apply it?
The ability to make class diagrams would be awesome. Right now I am forced to make dummy C# class that resemble my js so that I can generate class diagrams for them so that I can document my api for end users.
Dave,
Agree wholeheartedly about the outlining, and yes I would like to have Object Literals treated as block elements and outlined appropriately.
Beyond just color swatches in CSS, I would love to see the editor implement the image popup like that found in Firebug. Being able to hover over a Background image and have the editor resolve the URL ref and show me a small thumbnail of the image (if avail) would let me validate my image references are correct before I get to the browser.
The color picker features in the CSS editor would be WONDERFULL to have. I always have to have Adobe Fireworks open to get the hex value for a color, and that is a pain.
Hi,
Great post, i’m missing the most the “go to definition”
or even pressing F12 on a script include that will open that file.
two things that will bring you joy:
1. Ctrl+] in visual studio 2010 will navigate between { } of the scope – ALSO IN JS FILES :-)
2. And you must install JSEnhancements – http://visualstudiogallery.msdn.microsoft.com/en-us/0696ad60-1c68-4b2a-9646-4b5f4f8f2e06 – a Time saver
I would like to be able to add comments in my css that mark regions of the css file and then be able to navigate directly to those regions using the css outline tab. If you have a large css file it is so slow finding the right place in the file.
Maybe I am missing something, but isn’t the setting for the space before a method call in Settings > Text Editor > C# > Formatting > Spacing? Not findable at all, but it should be there.
The C# setting doesn’t affect the formatting in JavaScript files. Do you have a setting that lets you write:
And not have that formatted to:
On the closing brace?
Yeah, duh, you were talking about JavaScript. Yeah, odd that the JavaScript formatting options are very minimal.
Well actually, to answer your question, you can turn off the formatting on closing brace :-) Assuming you want the Visual Studio formatting at all. As soon as you go to format a file manually though, it’ll insert that space.
These are all completely valid points. Microsoft does treat client side development like a second class citizen, especially when it comes to OPEN standards, like HTML, CSS, and JavaScript. You can’t blame them though because they don’t make any money off it, or any increased “control”. So instead they focus on pushing XAML and stupid crap like that and Microsoft Developers flee in droves to other technologies.
There are two approaches to development. One is to keep everything simple. Make syntax highlighting almost not even necessary because a language is kept so bare and elegant. The second is to leverage an IDE product. The second one is necessary for applications of any decent size and complexity.
Microsoft makes Visual Studio, a very decent IDE. It used to be the ONLY decent one. So Microsoft could push their technologies on it, and there wasn’t much anyone could do about it. VS was created to promote Microsoft languages and technology. That’s where the money for it came from. …It made sense.
But these days, open web standards are becoming the norm. And unlike the days of yore, there are plenty of other IDE’s competing with Visual Studio, like Eclipse and other Open Source alternatives. …Ones that don’t have a “problem” or issue with promoting and supporting open standards. There’s real competition. Plus open standards tend not to be as bloated to even need an IDE.
So where does that put us? As Microsoft developers, we’re left with a dinosaur mentality from a company that still thinks it can slow or even keep open standards from becoming the norm. They’ll give us IDE’s that poorly support open standards, and let more and more MS developers go try out other technologies, and continue leaving in droves. …That’s pretty much the writing on the wall that I see.
You can’t blame Microsoft though. It’s a company used to making BILLIONS of dollars in an industry that only has millions or less to give out these days.
Your suggestions are really good. I wish VS team will take them into account.
Especially the one about “JavaScript code navigation” – it’s a must!
I couldn’t agree with you more!
Great suggestions in your post and in the comments!
On the CSS side, I’d love some type of “refactoring” support. For example, I’d like to be able to rename a class selector in my css and have the name changed in all my view pages. I’d also like to be able to take a style defined inline in a page and extract it to a css class or something (similar to an Extract Method refactoring).
Multi-line editing like e-texteditor, intype, or textmate (on mac) would be very nice.
I’m not to crazy about condensing properties except it will be something that is done when you request it (e.g. via a shortcut when the cursor is on a property or by right-clicking and requesting a code block be condensed)
Your suggestions for improving JS coding would be really nice!!!
Like others already mentioned the CSS improvements are only a topic of coding style. Except the color feature – but I think i would be better to display the color as a tooltip.
You’re forgetting the point that Javascript and CSS must be delivered to be useful.
Javascript and CSS minification and auto file aggregation will drastically enhance a website’s responsiveness.
Let’s think about full lifecycle development.
Build events make that pretty easy. This is how I used to do it with JSMin, for example: http://encosia.com/2009/05/20/automatically-minify-and-combine-javascript-in-visual-studio/
We’ve been using .less. The support for .config files is great, but it really is high time this gets baked into the IDE.
I asked the question about why there’s a space between function and the open paren. Douglas Crockford’s answer is http://tech.groups.yahoo.com/group/jslint_com/message/1291 I still contend the use of the keyword ‘function’ is a sufficient marker that I’m creating a function, but I was apparently out-voted. Given no way to control my formatting choices for JavaScript in VS, and given JSLint’s constant moaning that I didn’t, I too caved to the convention. It appears that because JavaScript has so little actual structure, for the purpose of maintainability, legibility, and durability, we must impose structure upon it via convention.
I would love to see the CSS suggestions implemented for the most part, but could live without the “Respect Existing Formatting/Hierarchies”…not that it wouldn’t be nice but it seems like the kind of thing that could
a – get in the way
b – be much more difficult to implement correctly than it sounds
c – take away dev resources I’d rather see focused on other improvements
Javascript extension for Visual Studio 2010
There could be a way to “group” css sections. So e.g. I group a bunch of lines that all are about the menu. This way I’d like to be able to expand/collapse these sections like you can for example with a div-tag in HTML. Would be a nice way to structur css and would benefit my secound “like-to-have” which is a “compress formate this”-button (delet all linebreaks, unneeded spaces..). In combination of these functions one could use only one css file (to reduce HTTP-request and only deal with on file) and have the control/overview at the same time.
Basicly render css view in editor and create css file that is used on the site are two different concerns that could be created from the same file, if you have Dave’s function of “define rules for hierarchical indenting, …”, a compress default when you save the file and a small “tag” to open/close a group (like /*g#1:*/ -> /*/g#1*/). (ok, those tags will use some space but the file will be smaller – in most cases – anyways.
Thank you for your wonderful post. After jQuery comes into action, I think I spent more time in writing javaScript than writing server side code. I agree with your post and it would be great to have all those(color picker, CSS Outlining, JavaScript formating ) into VS 2010. But I think VS team should include two more thing. Use of “Ctl +M +O”, which is a nice feature in .cs/.vb file and at the time of writing inline js on a file I want to see that control name pops-up. For example, when I write something like
$(‘#’).val()
It would be great help if as soon as I press <%= all controls name pop-up. That would save a lot of time on coding. What do you think Dave?
Ashfaq
As you said in your UPDATE, having most of these enhancement as Options would be best, since everyone has their own style.
I liked most of your suggestions, except for automatic reordering of CSS styles by property name. I intentionally group the properties by their “type”. Example, margin and padding together. If absolutely positioned, then position, left, top, right and bottom together. For fonts, I group font family, size, color together. Etc.
I’m usually not happy when VS decides to reformat things on its own. Back in the VS 2002/2003 days, it did this a lot. I generally prefer what I type is left alone. JS is one area where I think since VS 2010, it tends to indent blocks of code incorrectly — or at least unintuitively to me. I think it can be turned off, but then it might turn off too much.
Agree def. with all the issues pointed.
Using ctrl+shift+f to do anything in client-side dev. is a workaround, but i alway prefer other editors rather than VS because of the lacking features…
Good article I liked almost all of those ideas. I’ve especially found CSS editing and formatting lacking in Visual Studio. I completely agree that indenting style sheets based on depth helps readability and comprehension a lot.
Re: the spacing after the word “function”
This agrees with the recommendations of JSLint. In fact, I’ve found that JSLint and VS 2010 generally agree on document formatting in all regards except one: VS 2010 wants to indent case statements, and JSLint wants them to line up with the switch statement.
JSLint has its uses, but its recommendation on function() vs. function () is purely Crockford’s style preference. His reasoning there made a little sense before JavaScript syntax highlighting was commonplace, but it’s rare to find non-VS2010-formatted JavaScript that uses that style these days. There’s something awkward about that space.
That change from VS2008 to VS2010 was similar to switching the default C# brace formatting from Allman to K&R and dropping support for Allman at the same time.
Unless Microsoft releases an extension that gives us some of these ideas, then we will unfortunately never see them until Visual Studio 2012 (or whatever year we get the next version). I’m not saying I’d still love to have them, but I just wish Microsoft could release smaller updates to some of its products more frequently (like Chrome’s release schedule). This has technically been done for some other products through an “out-of-band” release, like the Silverlight Toolkit, but I’d like to see them just update the actual product. Maybe if most of visual studio was just a bunch of extensions, then they could update any of those extensions separately (like one for the designer). Instead, we have to wait years most of the time. Anyway, these are some great ideas for CSS and Javascript.
I think we can expect a VS2010 service pack that improves the client-side experience sooner than v.Next, like VS2008′s sp1 added JavaScript code completion.
The new extensibility model makes it much easier to write plugins to address these issues too (like the JSEnhancements plugin I referenced in the post). Hopefully, as that ecosystem matures, we’ll begin seeing lots of small plugins to make specific improvements, which can be continually improved as necessary.
I have a dream for VS2011.
A add-on that with a caption: “kill your graphic designer”
xD
Hi there,
Great, common sense!
I know I’m late to the party but I cannot agree with this more. Having come from a PHP background, working with the Eclipse IDE, to C# based web development with VS2008, the sudden increase in how bloody difficult it was to work with css and js was a shocker. Ouch.
My workaround is to have eclipse running at the same time as VS 2008 and edit my JS and CSS in that – it was simply taking too long to navigate around my JS docs.
Resharper 6, currently on beta, is adding JS code navigation and some other stuff too.
Good news for me is that we’re getting VS2010 soon, so I’ll give jsenhancements a go.
Thanks for putting into a well ordered, FAO Microsoft list what I’ve been thinking.
G
Hey guys,
I had a sneak peak at the next Visual Studio release at the BUILD conference a couple weeks back. A lot of these features are coming in the next release. I saw the color picker for CSS, they also showed go to function in javascript and also all the javascript functions in a drop down like in the .NET code. They also have a way to optimize all your project’s image files, and best of all, minify and bundling of javascript and css files is all built in! I’m excitedly looking forward to its release.
It definitely has some nice improvements. You can download the “Visual Studio 11 Developer Preview” on MSDN and use it today if you’re inclined. I’ve been using it in place of VS2010 since BUILD and it has been stable. Since it doesn’t require converting the projects to a VS11-only format like VS2010 did, it’s safe to go ahead and give it a try early without having to worry about painting yourself into a corner.
Most of the suggested features are available for Visual Studio 2010 through the free extension Web Essentials http://visualstudiogallery.msdn.microsoft.com/6ed4c78f-a23e-49ad-b5fd-369af0c2107f
Thanks Mads for the extension, installed it and it’s awesome!