Rick Strahl's Weblog  

Wind, waves, code and everything in between...
.NET • C# • Markdown • WPF • All Things Web
Contact   •   Articles   •   Products   •   Support   •   Advertise
Sponsored by:
Markdown Monster - The Markdown Editor for Windows

No JavaScript IntelliSense in VS 2010 Beta 2? Reset your Settings


:P
On this page:

When I installed Visual Studio 2010 a couple of days ago I was really disappointed to see that JavaScript Intellisense failed to work completely in the new install. No workey in .js files, or ASPX pages inside of script blocks. After some back and forth with folks on the ASPInsiders list and the product teams it looks like there is an issue somewhere with the default settings that get set when Visual Studio 2010 first installs.

This doesn’t affect all installs, but there were handful in a small group of folks, so this is likely going to hit a few of you trying out Visual Studio 2010 as well.

To get Intellisense to work again, thanks to a tip from Luis Abreu, I ended up resetting my Visual Studio settings (Tools | Import and Export Settings):

ResetSettings

then go ahead and reset to your preferred default profile (I typically choose the C# profile over the Web profile). This may seem counter intuitive immediately after a new install since I hadn’t changed any settings yet, but the reset did the trick.

And voila, Intellisense in JavaScript is back.

I suspect this has something to do with VS 2010 importing some existing VS 2008 settings, so even if you don’t have problems in VS 2010 it might be a good idea to actually reset all settings just to make sure there’s a clean slate to start with.

Hope this helps out some of you.

Other JavaScript Editor Thoughts

One nice feature that will be quite useful is support for CodeSnippet Expansion in JavaScript, which means you can automate common tasks with keyboard expansions. Since there’s no CodeRush for VS 2010 yet and I keep typing my CR shortcuts out of habit, I guess I’m going to fix up some my more common shortcuts as code snippets (especially for ASP.NET snippets). The main reason I didn’t use Code Snippets extensively in the past is because there was no support for ASP.NET and JavaScript but now there’s much less of an excuse. While I still prefer the ease and flexibility with which you can create new shortcuts in CodeRush, the VS Code Snippet functionality is relatively nice and easy and it’s built in and easily portable to other VS installations.

jQuery support (with the –vsdoc.js extension files) is now also baked in VS 2010 – jQuery Intellisense just works out of the box and it seems that Intellisense is much more snappy. No more long delays before it works even in large script files and quicker IS pop ups while typing. The JavaScript Intellisense engine (according to release notes) has been reworked to be more flexible and supposedly faster because of it and this first quick checks seem to confirm that.

There are also some improvements in the code formatting behavior which in the past drove me batty with its inconsistent Indenting, re-indenting, outdenting etc. It appears that now the editor gets the intended behavior right most of the time – the result is the auto-format is a heck of a lot less jumpy than it used to be. In a few tests of a script heavy app I’m working on the auto-indenting with often nested jQuery code ended up working predictably and not jumpy as in 2008. Not exactly a new feature but  I’m just glad to see this working much better the way it’s supposed to.

Unfortunately the JavaScript editor’s improvements in general are rather minor. There’s still no code navigation of any kind (no function list drop down or class/function/navigator) which IMHO is the biggest shortcoming of the VS JavaScript editor. Disappointed as there was some discussion that this was a coming feature for the VS 2010 editor. Anything beyond Ctrl-F to find code inside of the JS editor would be useful.

Also Refactoring inside of JavaScript surely would be nice. At the very least renaming support is something I wish for in many occasions. Basic function extraction would be useful too as well as block optimization refactorings, but renaming really is the one I would like more than anything.

Anyway, it looks like minor improvements at this point and let’s hold out hope there may still be additional improvements by the time VS 2010 ships.

Posted in JavaScript  Visual Studio  

The Voices of Reason


 

James Curran
October 23, 2009

# re: No JavaScript IntelliSense in VS 2010 Beta 2? Reset your Settings

Yup, same thing happened to me, but with ALL intellisense. I too think there is some attempt to import vs2008 settings, as my font preference was carried over. I reset the environment settings and intellisense worked again.

Benjamin
October 23, 2009

# re: No JavaScript IntelliSense in VS 2010 Beta 2? Reset your Settings

I had the same IntelliSense issue with my JavaScript.

I appreciate the post, thank you.

Cheers

Ben
October 23, 2009

# re: No JavaScript IntelliSense in VS 2010 Beta 2? Reset your Settings

Visual Studio's JavaScript IntelliSense is second to none. You have to remember that JavaScript, unlike C#, is a dynamic language, and that the object graph (and makeup) can change dramatically during execution. The only reason Visual Studio knows that $("your selector") has the "addClass" member function is because Microsoft have assembled immense amounts of metadata for JQuery.

I believe expecting anymore from Visual Studio in this regard is unrealistic.

Mark Kadlec
October 23, 2009

# re: No JavaScript IntelliSense in VS 2010 Beta 2? Reset your Settings

Good tip, I also use this method for when VS2008 loses it's Server Explorer (it does this every few months, haven't figured out why)

It's a good environmental fix, unfortunately you may lose some manually customized settings.

Rick Strahl
October 23, 2009

# re: No JavaScript IntelliSense in VS 2010 Beta 2? Reset your Settings

@Ben - uhm, there are other tools out there that do a more complete job with JavaScript editing than Visual Studio including some small vendors. I realize it is hard to figure out program structure in JS, but it's not impossible - after all Intellisense already parses the .js file to find what it displays. Take a look at Aptana and it's JS environment and how it handles displaying program logic and Intellisense.

But, using an external tool is also a pain (especially since from a UI perspective Aptana and others are rather rough) and so I do use VS for my JS editing and put up with it - I'm asking for that experience to improve in my own selfish way :-}

Visual Studio's JavaScript editor is not bad for plain code editing but there's absolutely no code navigation in the same file which is really a needed feature. Building client heavy applications/pages often results in sizable chunks of client code for individual pages and being able to find functions in those .js files is time consuming now. It obviously is possible to do this, but unfortunately resources at Microsoft do not seem to have been invested in this so far.

Ben
October 24, 2009

# re: No JavaScript IntelliSense in VS 2010 Beta 2? Reset your Settings

@Rick

Not meaning to get into an argument, but:

var MyClass = function(myVar) {
this.myVar = myVar;
};

MyClass.prototype = {
// MyClass members
};

Even web browser JavaScript engines do not know what the name of MyClass actually is, simply because the function is unnamed - it has only been assigned to a variable MyClass. Given the wide variety of ways in which you can define a "class" in JavaScript, I don't think any IDE can provide conclusive support. Therefore, given that there is a distinct possibility that the IDE will incorrectly process my source, I'd rather see it only provide functionality which is guaranteed to be correct in all cases.

If the IDE wants to provide specific support for libraries such as JQuery and Prototype, then I am fine with that.

However, I would resist anything added to Visual Studio which slows its performance. Microsoft's JScript engine is slower than most, and since the only real way to establish a JavaScript object graph is to execute it, I would argue that performance would decrease significantly.

I am unfamiliar with the software you quoted, and without trying it I won't judge it - but I would be highly surprised if I couldn't flummox it within a minute.

Great blog btw!

Rick Strahl
October 25, 2009

# re: No JavaScript IntelliSense in VS 2010 Beta 2? Reset your Settings

@Ben - you should give Aptana a try. It's a quirky environment (for coming from a VS background) but it's interesting to take a look and see what is possible in code visualization. It does a pretty good job of finding members and functions in maps, and closures as well as prototype overrides.

Hard? I imagine so, but apparently possible. Also remember that VS is already doing all this parsing for Intellisense - it CAN detect maps and functions within them as well as classes and members - it works inside of Intellisense and it appears that this parsing is working much better in VS 2010 than prior versions. IOW the hardest part they have already done :-}

Ben
October 26, 2009

# re: No JavaScript IntelliSense in VS 2010 Beta 2? Reset your Settings

@Rick

I must admit Aptana is very, very good indeed. However, I did manage to flummox it within a few minutes. I must admit after seeing this that there certainly are things Visual Studio can do to improve its JavaScript support, however I honestly would prefer a lightweight IntelliSense, as I write my JavaScript in a very "odd" way (I use the Class.extend approach that Dean Edwards originally came up with "back in the day").

So as long as you can turn off certain features then, yes, they can have a good crack at it looking at the majority use case.

Joshua Starr
October 26, 2009

# re: No JavaScript IntelliSense in VS 2010 Beta 2? Reset your Settings

Thanks for the tip Rick, I ran into the same situation where none of the intellisense was working when I first installed 2010 last week. I know for a fact that it imported my 2008 settings because my "Dark-Themed" dev environment had all of the code editing colors set in 2010. Resetting and then reimporting my 2k8 color settings worked fine.

On an Intellisense note, I freaking love it. My roots were originally in Unix/Linux programming with GCC and VI. Work smarter, not harder, right? :)

Vinod Nair
October 27, 2009

# re: No JavaScript IntelliSense in VS 2010 Beta 2? Reset your Settings

Thanks for the tip. I ran into the same issue with the VS2010 ultimate edition installation.

Hector Minaya
November 05, 2009

# re: No JavaScript IntelliSense in VS 2010 Beta 2? Reset your Settings

Thanks for the info, I was banging my head against the wall trying to figure out where my intellisense had gone....

Navin Patro
February 15, 2010

# re: No JavaScript IntelliSense in VS 2010 Beta 2? Reset your Settings

Thanks for the tip. I had the same issue. You saved my time.

Thanks

Andrew Johns
April 15, 2010

# re: No JavaScript IntelliSense in VS 2010 Beta 2? Reset your Settings

Looks like I can't use the CDN examples since I moved to VS2010:

<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.1.js" type="text/javascript"></script> 
<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script type="text/javascript" type="text/javascript">
$ <-- this isn't working
</script>


But then I don't usually do this anyway - I've been using the Google CDN for the actual jquery reference, and in my external JS files I had been doing this:

/// <reference path="/../Compiler Tools/jquery-1.4.1-vsdoc.js" />

which looks outside of the project root, and finds the reference inside a tools folder I have, meaning I only need to keep one copy of the vsdoc file to enable it in multiple projects.

Now this works fine in VS2008, but in VS2010, it looks like it only works for me if I actually have the vsdoc file inside the project.

Paul
May 19, 2010

# re: No JavaScript IntelliSense in VS 2010 Beta 2? Reset your Settings

Thanks a lot for this !

Praveen
December 16, 2013

# re: No JavaScript IntelliSense in VS 2010 Beta 2? Reset your Settings

Excellent.. I have been looking for this for almost 6 hours finally found the solution from this link.. Thanks alot.

West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2024