Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Javascript-GotoDefinition and Intellisense VS2012
Message
From
22/03/2013 09:08:42
 
 
General information
Forum:
ASP.NET
Category:
Visual Studio
Miscellaneous
Thread ID:
01568986
Message ID:
01569020
Views:
32
>>I'm sure almost everyone else knows this but maybe it will save one person some frustration:
>>
>>While studying the js scripts in John Papa's Code Camper app (highly recommended) I could not get F12 or the right-click Go to Definition to work on javascript objects. Was trying to figure out as I looked at each js script where the stuff being used was defined,and there were at least 50 scripts that were candidates.
>>
>>Finally caught on that if you drag a script from Solution explorer onto the script you are looking at then it will be part of a definition search. Great,for jquery or jquery-ui but do I want to drag 50 scripts onto each script I am examining.???
>>
>>Solution : adding all references to a script called _reference.js will make all the scripts referenced available globally for intellisense and object definition search. (each added, including /// by just dragging from Solution Explorer. )
>>
>>Hope this saves somebody some time and frustration.
>>
>>( BTW, the _references.js does not have to be included into the project, it is strictly a design time thing)
>
>Isn't the _references.js file now created automatically by the project template ?

Yes, I believe it is. For a WebAPI app the jquery and knockout libraries are added by default, but I think you have to add other libraries manually in order for them to show up globally for intellisense and object search.

In this case, I needed a way to have *all* js files be part of intellisense and object search since I was examining a complex app written by somebody else and was trying to figure out what routines were defined in moment.js or TrafficCop.js or amplify.*.js etc. or just in another script he had created for the app ( a UOW etc )

In the training videos John Papa - who is using Resharper which will find anything in the project - was just hitting F12 and boom - he went to the referenced object. And while he said "or you can right-click and Go to Definition" neither one was working for me on calls outside of standard jquery or knockout.

That said, I am going to buy Resharper now. Can't have too many cool tools :-)


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform