I assumes that you have created a project in Visual Studio 2012/2013 by using the Empty SharePoint Project or App for SharePoint template:
A reference directive (_references.js) enables Visual Studio to establish a relationship between the script you are currently editing and other scripts. These scripts reference could be any kind of scripts files, it’s could be JSOM files under _layout directory, other script file in your project, disk-based script files or global script files that have http:// prefix. Note: Should be only one _references.js file for each project and is located should be in the scripts directory. You create a reference directive in the form of an XML comment. The following example shows using JSOM reference directives: /// <reference path="~/_layouts/15/init.js" /> /// <reference path="~/_layouts/15/SP.Core.js" /> /// <reference path="~/_layouts/15/SP.Runtime.js" /> /// <reference path="~/_layouts/15/SP.UI.Dialog.js" /> /// <reference path="~/_layouts/15/SP.js" /> Now you can use IntelliSense feature when you write your JSOM code: Note: Sometime you apply all previous steps but Visual Studio don’t catch the added reference directives, and the IntelliSense don’t work. Don’t worry it’s not your fault, just restart the Visual Studio and IntelliSense shall work correctly. Example Download
A reference directive (_references.js) enables Visual Studio to establish a relationship between the script you are currently editing and other scripts. These scripts reference could be any kind of scripts files, it’s could be JSOM files under _layout directory, other script file in your project, disk-based script files or global script files that have http:// prefix. Note: Should be only one _references.js file for each project and is located should be in the scripts directory.
You create a reference directive in the form of an XML comment. The following example shows using JSOM reference directives:
/// <reference path="~/_layouts/15/init.js" />
/// <reference path="~/_layouts/15/SP.Core.js" />
/// <reference path="~/_layouts/15/SP.Runtime.js" />
/// <reference path="~/_layouts/15/SP.UI.Dialog.js" />
/// <reference path="~/_layouts/15/SP.js" />
Now you can use IntelliSense feature when you write your JSOM code: Note: Sometime you apply all previous steps but Visual Studio don’t catch the added reference directives, and the IntelliSense don’t work. Don’t worry it’s not your fault, just restart the Visual Studio and IntelliSense shall work correctly. Example Download
Gokan Ozcifci edited Revision 4. Comment: Removed SharePoint Tag
Carsten Siemens edited Revision 3. Comment: Added tag: en-US
Muawiyah Shannak edited Revision 2. Comment: restart the Visual Studio
Muawiyah Shannak edited Original. Comment: add note