My JavaScript book is out! Don't miss the opportunity to upgrade your beginner or average dev skills.

Saturday, December 20, 2008

Visual Studio 2008 and JavaScript: the worst couple ever

We are using Visual Studio 2008 Team Edition at work and it is great for our C# plus SQLServer application, but I am working entirely with JavaScript and every time my files grow up "too much" I start having headache scrolling up and down thousands of line of code.

A basic function that even a small editor like Notepad++ has, the plus/minus sign to close functions closures, does not exists.

You should try to create your own macro, in VB "of course", and call it every time.
As alternative, I added the file extension js in the option with HTML Editor as default editor to let me do something like this

//#region MyConstructor <script>

... my code

//#endregion </stript>

Above start and end comment allows me to close code blocks and everything inside will be highlighted because the editor consider it as an HTML JavaScript tag:
it's true, HTML has open/close blocks while JavaScript does not.

The "fantastic" debugger is nothing that better than the one you can find inside Internet Explorer 8, the only point is that it is integrated with the rest of the project so you can debug both JavaScript and C# at the same time ... without this big effort.

I use FireBug and/or Chrome console indeed, since I do not need to monitor C# that much, and that's it, client side debug feature completely useless under IE ( and I downloaded the version 8 beta 2 yesterday so I can use its debugger instead of launching another local server for client side debug ... )

The intellisense sucks, it does not work automatically as is for C# or other languages or as is for Eclipse or Aptana, you have to put useless syntax in the top of the file to tell the big IDE where are other files.

The suggestion is so clever that if you have a property whose name starts with el, the IDE will autmatically put an else

myObject.else // by the ide

The internal parser does not recognize properly functions as objects, and inheritance is not part of the suggestion ... you should try to disable it if you want to code faster instead of correct IDE suggestions.

In few words, I still wonder why Microsoft is doing everything to discourage the usage of JavaScript and I can't wait to find a valid alternative to integrate my JavaScript projects into source control without being constricted to use the best IDE for C# and the worst ever for JavaScript: Visual Studio 2008

Kind Regards


laplix said...

Hi Andrea,

I just passed the last couple of hours reading your blog and discovered many beauties such as JSL and MyMin.

Thank you so very much of sharing.

But like one or two commenters said, you really should promote your work here, on this blog. Articles are nice but if we don't get to read them, we don't get to see your work. A few nice icons or links on top of your right column (or left even) would go a long way to make your work known.

Just my 2¢
Thank you again

Anonymous said...

Since you mentioned that you like Eclipse/Aptana...have you looked into Emonic and NAnt for doing .Net and Mono development with Eclipse?

Andrea Giammarchi said...

no but I am writing my own macro to create closures properly :D

A.In.The.K said...

I share disapointment about 2008 and js. However do someone have good JS tools ? Do we have review of outline, navigation, formating and source control deatures of different IDes ?

Andrea: Have you tried to open your very own .WebReflection.javascript in the latest Aptana ? The outline gives you one and only wr variable.

Consider article about benchmarking the IDE (NET 2008, Aptana, 1st JavaScript Editor......) and different features when opening sources of unpacked ibs like WebReflection, YUI, GWT, Dojo, MooTools, JQuery .....?

Maybe port your mapper code as eclipse plugin ?

Andrea Giammarchi said...

I miss the question and the point, and the lib you are talking about ... while what I am talking about is that Eclipse, Aptana, and Notepad++ are better JavaScript editors than VS 2008

A.In.The.K said...

1,st point is:
What IDE to use ? (I expected your and others opinion or good article with comparision). SourceControl integration is MUST.

2.point is, Tools have very limited parsing capabilities.
Try to open source code in Aptana, .NET, or other studio and see Outline View. How many functions, variables, literals and other JS fragments can be parsed from source ?

Andrea Giammarchi said...

1. whatever IDE it is, it will be better than VS thanks to proper JS parser. Aptana as Eclipse and others, can use svn and others source control programs without effort, no?

2. that code is not updated but in any case I see what you mean. What I can say, is that even with Notepad++ I can better organize that file closing functions scopes, as example.
If VS was excellent with JavaScript as is for C#, it would have been the best tool ever. Unfortunately, it's simply not like that.