11

Whether you are forced to code javascript in Visual Studio 2010, or insist on using Visual Studio 2010 instead of another IDE, I'm wondering what anyone has done to improve the javascript development experience in VS2010.

I'm asking since javascript support is lacking in Visual Studio 2010. You don't get the the kind of support you get as if you were developing Silverlight apps in C# and XAML. For example, the intellisense doesn't support javascript 1.8.5 (or even 1.6 functions i.e. JSON.Parse), it's difficult to navigate to function or object definitions (no Go To Definition), no Object Browser, Call Hierarchy, and the list can go on.

What have you done to compensate for the VS2010 features that don't exist for javascript? Also, what would be a good feature request to support javascript development; anything that VS2010 should add as an extension or a future release? Also, are there any suggestions to manage the .js code for large projects?

A few things that have helped me so far are the JScript Editor Extensions, and the Web Standards Update. Also, when working in .js files I rely on bookmarks to get back to key places, since the functions of the file aren't visible (as the would be in C#). My feature request would be to add intellisense support by javascript version, similar to how you can target .NET 2.0, 3.5, or 4.0.

T. Webster
  • 9,605
  • 6
  • 67
  • 94
  • 4
    Code, compile, pray it doesn't break. – slandau Jul 01 '11 at 14:03
  • What is "javascript 1.8.5"? Either way, Resharper 6 comes with a lot of improved js support, intellisense is part of that (and reflected upon based on included javascripts IIRC. – jishi Jul 01 '11 at 14:10
  • @jishi see: https://developer.mozilla.org/en/JavaScript/New_in_JavaScript/1.8.5 – T. Webster Jul 01 '11 at 14:12
  • 2
    I wouldn't advise using anything that's not part of ECMA standard unless you only want your web site to work in firefox. Just sayin'. – Jamie Treworgy Jul 01 '11 at 14:27
  • @jamietre maybe so, but it still would be nice to at least have the *option* of javascript 1.6 intellisense support. Some js APIs e.g. websockets are still in draft, too, but that doesn't mean to not try experimenting with it. – T. Webster Jul 01 '11 at 16:52

3 Answers3

6

There are a number of VS extensions to assist with javascript:

Visual Studio Javascript extensions feature comparison

JSEnhancements is awesome, and does what you really want: adds regions and code block collapsing.

Also see this extension: http://code.google.com/p/js-addin/

which parses your script into an object tree that can be used for navigation.

I have also used the free version of this editor: http://www.yaldex.com/JSFactory_Pro.htm

I can't recommend it, unfortunately, because it suffers from a couple critical problems (awkward UI, freaky intellisense, and not entirely stable). Which is too bad because it's a very thoughtfully designed piece of software by and large, it just fails where the rubber meets the road.

Community
  • 1
  • 1
Jamie Treworgy
  • 23,934
  • 8
  • 76
  • 119
  • 1
    +1 this is a good answer. I ended up finding that JScript Editor Extensions also has the code block collapsing, and brace matching. They claim support for summary tags but I haven't seen it work. The code.google link I was thinking of trying, and it's also in the VS extensions gallery. – T. Webster Jul 01 '11 at 16:49
  • 1
    Yeah I think that one is pretty similar to JSEnhancments which I use. I just found the js-addin one while thinking about this question, and it is also a nice addition. – Jamie Treworgy Jul 01 '11 at 16:51
4

1) Install Resharper, helps a lot when building javascript heavy web apps.
2) Get FireBug for debugging.
3) Also, the JQuery.vsdocs files are sometimes helpful!

RoelF
  • 7,483
  • 5
  • 44
  • 67
  • did you have to buy a license for Resharper? if so, how much? Yes I use the jQuery vsdocs, but they don't catch everything, i.e. native browser API functions. – T. Webster Jul 01 '11 at 14:13
  • 2
    Resharper is indeed not free, although they have a 30 day evaluation. Prices are on the website, and well worth the money imo (no, I'm not in any way affiliated with JetBrains, it's just an awesome product.) – RoelF Jul 01 '11 at 14:21
3

While I use vim and Notepad++ to cut code, I feel your pain, or did until I started using Firebug to debug JavaScript. While it many not be exactly fitting for your situation it's invaluable to me in developing Web based apps:

http://getfirebug.com/

Raoul
  • 3,849
  • 3
  • 24
  • 30