Javascript reference and Intellisense in Visual Studio 2013 .coffee files - javascript

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

Related

Minify a JavaScript file to the root JS file extension in Visual Studio

Developing .NET web projects, I'm used to using either the bundleconfig.json and/or compilerconfig.json file to bundle and/or minify javascript (and css) files. Is there a way to use either of these methods or some other method to minify a source javascript file (located in a folder outside of wwwroot) to the root .js file extension? I don't want the minified output to be filename.min.js, I want it to be filename.js (but minified).
I know ultimately, I can manually rename the files to accomplish this, but I'd rather it be automated in Visual Studio if possible.
Also, if it helps, I'm currently building this project in .NET 6.
Search for Visual Studio Code Minify plugin on Google. There are many here. For example, https://marketplace.visualstudio.com/items?itemName=MadsKristensen.BundlerMinifier https://marketplace.visualstudio.com/items?itemName=fbdegroot.Minifier.

How to make the IDE recognize that I have jquery included in the HTML file?

I have a little problem.
I am including the jquery.min.js file as a script in my HTML file, but I want to use the jquery functions in a seperate .js file. In a situation like this the IDEs like PhpStorm or Visual Studio 2013 won't recognize that the jquery.min.js has been included in the HTML file. My problem with this is that VS won't autocomplete the jQuery functions that I use, and sometimes PhpStorm will have a problem with this as well. Of course the code will work when I test it in a browser, but I would like to have some syntax highlighting and autocompletion as well.
How can I state it to the IDE that I've included the needed jQuery file in my HTML page so that it will start recognizing the syntax and help me with autocompletion?
Thanks!
In Visual Studio, you can define reference path of your jquery.min.js on top of your .JS file. Also you can just drag and drop the jquery source file to your seperate .JS file and Visual Studio will automatically generate the reference path for you.
/// <reference path="Libraries/jquery.min.js" />
//rest of your code starts

Visual Studio 2013 not Syntax Checking js files

Visual Studio 2013 isn't verifying .js files.
I have a separate .js file under a Scripts folder, that is then referenced in my ASPX page.
The intellisense works when the script is within an html page or a .aspx page, but not in a .js file.
Is there something I'm missing?
In order to get intellisense to work with js files referenced on your web pag you need to add a _reference.js file. It really doesn't matter where you put the file, but generally it should be placed along with the rest of your js files. Perhaps in a SCRIPTS folder.
Here is a good article explaining it in further detail.
For More Info: (http://gurustop.net/blog/2012/03/03/javascript-js-intellisense-auto_complete-in-visual-studio-11-beta-the-web-_references-js-file)

How to get Typescript files to hit breakpoints in the original file, not in Dynamic tab?

Before upgrading to Visual Studio Premium 2013 Update 2 RC, when I add a breakpoint in a Typescript file, the breakpoint will hit in the original Typescript file. However, after the upgrade, when the breakpoint hits, a new tab in Visual Studio opens with the title and the code pauses in the dynamic file instead of the original typescript file. How can I make the breakpoints hit in the original Typescript file again? I have marked the typescript file properties to be "Do not copy", so I don't understand why it is being considered as Dynamic? Nothing is being generated on the fly here?
Do you see a .map file along w/ a .js file? When you compile your Typescript you need to use the compiler option of -sourcemap
This will create a .map file that VS2013 uses to know how to map the js file to your typescript file.
so in your folder you should see:
file.ts
file.js
file.js.map

javascript intellisense in Visual Studio

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.

Categories