javascript intellisense in Visual Studio - javascript

How can I get JavaScript IntelliSense in Visual Studio 2008 and in Visual Studio 2010 ?
How can I get jQuery IntelliSense in Visual Studio 2008 and in Visual Studio 2010 ?
If I fail to get the above, let me know 'Which is the most used JavaScript Editor which can replace VS versions for editing javascript files?

or you can simply drag and drop your javascript into your .js file and it creates entry like this:
/// <reference path="jquery-1.6.2.js" />
worked fine on my VS 2010 (Premium version)

I'm using VS2010 with ReSharper 6 which adds powerful JS Intellisense support. Autocomplete works for all JS files in the solution as well as jQuery. But it's not free.

Go to Tools-Options-Text Editor-Javascript-Intellisense-References and place a reference to the intellisense files for the version of jquery you are using in the Implicit Web group.
OR
place an "add reference" to the intellisense file in the _references.js file which you can add to the Scripts folder of your project.
/// <reference path="jquery-1.8.2.js"/>
/// <reference path="jquery-1.8.2.min.js"/>
/// <reference path="jquery-1.8.2.intellisense.js"/>
Though this will only provide intellisense for the project you are in, the first will for any open js file.
To get the latest jquery files with intellisense use the nuget package installer which by default will create a scripts folder and place the jquery version.js, the min.js and intellisense.js files into... from there you can copy them to the location most of the Microsoft references are placed which is typically
C:\Program Files (x86)\Microsoft Visual Studio 11.0\JavaScript\References

VS 2008/2010 has built in JavaScript IntelliSense.
If you have the corresponding "-vsdoc.js" file next to your jQuery file VS 2010 offers IntelliSense out of the box and VS 2008 needs SP1 installed and the patch at http://code.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=1736
No need, really.

http://archive.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=1736
Wow... I followed the method described above.. Awesome....

You should get the jQuery files from Asp.Net CDN. They have VSDOC and are able to give very good intellisense and documentation support.

Related

Visual Studio 2017 not compiling typescript

I recently updated to VS 2017 and I'm using a solution that used to work perfectly in VS 2015. I have enabled the "Compile on save" function in Tools > Text editor > TS/JS > Project and I'm sure I'm using the correct "code generation" option, but VS won't compile any typescript file.
The js output file already exist, it was generated by VS 2015, and when I save the ts file the bottom bar shows the "Output(s) generated successfully" message but there is no change in the js file.
Note that the project is under source control, but both ts and js files are checked out for edit.
I read online that similar issues were been resolved with lastes VS updates, and I'm sure my version of VS is up to date.
Does anyone know what's going on?
Check ts file properties in Solution explorer. If Build action = Content, change it to TypeScript file
in a .NET Core 2.1 project in which I has used VS's New Project template for React, I had to edit the .csproj and change <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked> to false.
Why does this option even exist!?!?!
Solved by installing gulp and manually compile TypeScript when necessary.

Visual Studio 2013 - publish minified javascript only

Environment:
Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.51209
I have a website project that contains some javascript files. Visual Studio minifies javascript files automatically -- for example, if the "source" file is called "myscript.js" -- Visual Studio will also create a minified version called: "myscript.min.js" -- which is great...
When I right-click on the file name in Solution Explorer and select "Publish myscript.js" - Visual studio publishes three files:
myscript.js
myscript.min.js
myscript.min.js.map
However, I want to publish ONLY the minified version of the file to the web site -- problem is, if I use the "Exclude From Project" setting (right-click on "myscript.js" -> Exclude From Project"); Visual studio will also exclude the minified version of the source file.
Is there a setting in Visual Studio that allows us to specify that only the minimized version of the file be published when selecting the "Publish" option within Solution Explorer???
PLEASE NOTE: I am NOT asking for an MSBuild or MSDeploy solution (this is NOT a web APPLICATION; it is a website project) -- I want to be able to publish a single file at a time (in this case javascript) but I do NOT want the main source file published -- only the minified version.
The only solution I have found is to manually publish the minified version, and then manually delete the "source" file from the web site; but it would be nice if Visual Studio had a setting that would prevent the javascript "source" file from being uploaded to the server.
Perhaps no such option exists? (Guess I am just looking for confirmation).
Thanks.
My advice would be to use Web Essentials (http://vswebessentials.com/) and go to Web Essentials => Edit Global JSCS Settings (.jscssrc) and add
"excludeFiles": ["scripts/myfile.js","app/services/*", "app/controllers/*"]
More info here: How can I configure Web Essentials 2013 to ignore files?

JavaScript Intellisense in Visual Studio Community 2013 with NTVS (Node.js Tools)

Using VS2013 Community Edition with Nodejs Tools for Visual Studio, the issue is that the intellisense for js files && classes is not working at all.
Dont have Resharper installed so it is not related to it.
I looked into text editor-> javascript -> auto list member is checked.
I also cannot add reference files to js files in a Project of type "From Existing Node.js Code" or "Blank Nodejs Web Application", also cannot create "_references.js" file neither through Web Essentials neither through Add -> Javascript Intellisense.
The project is front end running on node js.
Basically we use require js to load different modules (backbone : views, models etc ).
So as you see the intellisense it not working for this.getEmptyResponse.
https://trello-attachments.s3.amazonaws.com/54c0f5ffef5a644796f37cbc/851x222/4fb7e502f05f8b0ad01f2e58aee7241d/intellisense1.png
Also if i you require or define, it also doesnt show up anything.
And i cannot create javascript intellisense file either.
https://trello-attachments.s3.amazonaws.com/54c0f5ffef5a644796f37cbc/677x466/7e01ade2c13072a9ac8534ac90b7391d/intellisense2.png
Any help would be appreciated !!

Javascript reference and Intellisense in Visual Studio 2013 .coffee files

Just started using Web Essentials and love its support of .coffee files. Big problem however: In Visual Studio, if you add the following reference to the top of a .js file, Visual Studio will include intellisense for the items in the referenced file:
/// <reference path="../../js/knockout-3.1.js" />
So, while writing my code I can type something like ko. and intellisense shows me all the functions knockout has to offer.
However the above XML reference is not allowed in .coffee files and in fact keeps them from being compiled. I can put the following in a .coffee file:
# #reference ../../js/knockout-3.1.js
This will compile but I lose the intellisense in Visual Studio.
How can I "include" other .js files as a reference and trigger intellisense in a .coffee file?
This is not currently supported.
See this stack overflow question:
CoffeeScript Intellisense
Also see this suggestion from web essentials:
https://webessentials.uservoice.com/forums/140520-general/suggestions/3782958-coffeescript-intellisense
I use VS2015. The way i do it is update the "references.js" file (right click on that file and click update)
see screenshot

What is the _references.js used for?

What is the _references.js file used for in a new ASP.NET MVC 4 project?
In VS 11, Visual Studio will give you intellisense from all files
that have references in the “_references.js” file.
For More Info
MSDN documentation: JavaScript IntelliSense
In brief, _references.js stores the list of JS files paths, for which you want the Visual Studio to gather and build the intelisense (aka "code complete"). The VS project adds there some common JS libraries like jQuery to build the intellisense for it. You can add a reference to your custom JS file in form like this:
/// <reference path="MyScriptFile.js" />
From Visual Studio 2017 forward, this file is no longer used.

Categories