{"id":3681,"date":"2015-06-10T09:45:00","date_gmt":"2015-06-10T09:45:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudio\/2015\/06\/10\/javascript-editor-improvements-in-visual-studio-2015\/"},"modified":"2022-05-18T08:40:52","modified_gmt":"2022-05-18T15:40:52","slug":"javascript-editor-improvements-in-visual-studio-2015","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/javascript-editor-improvements-in-visual-studio-2015\/","title":{"rendered":"JavaScript Editor Improvements in Visual Studio 2015"},"content":{"rendered":"<p>JavaScript is an important technology for development on many different platforms, including web, mobile app, and server programming. In Visual Studio 2013 we already support IntelliSense, Go to Definition, colorization, and formatting of JavaScript source, along with several other features. We&rsquo;ve carried these forward into <a href=\"https:\/\/www.visualstudio.com\/en-us\/downloads\/visual-studio-2015-downloads-vs.aspx\">Visual Studio 2015<\/a> and we&rsquo;ve improved the experience for JavaScript developers by focusing on three key areas:<\/p>\n<ol>\n<li>Improving the development experience when using popular JavaScript libraries<\/li>\n<li>Adding support for new JavaScript ECMAScript 2015 (also known as ES2015 and formerly ES6) language and web browser APIs<\/li>\n<li>Increasing your productivity in complex JavaScript code bases<\/li>\n<\/ol>\n<p>Each of these areas was chosen based on feedback we heard on <a href=\"http:\/\/visualstudio.uservoice.com\/forums\/121579-visual-studio\/category\/31477-languages-javascript\">UserVoice<\/a>, through social media, via the <a href=\"https:\/\/connect.microsoft.com\/VisualStudio\/content\/content.aspx?ContentID=31113\">send-a-smile\/frown feature in Visual Studio<\/a>, and from many direct discussions we&rsquo;ve had with developers like you.<\/p>\n<p>In this post, I&rsquo;ll highlight the new features of the JavaScript editor for each of these areas. You can take advantage of these features in all JavaScript projects supported in Visual Studio.s<\/p>\n<h2><a name=\"PopularJavaScriptLib\"><\/a>Support for popular JavaScript Libraries<\/h2>\n<h2>AngularJS 1.x and RequireJS support<\/h2>\n<p>By default, Visual Studio 2015 supports the very popular <a href=\"http:\/\/www.angularjs.org\">AngularJS<\/a> and <a href=\"http:\/\/www.requirejs.org\">RequireJS<\/a> libraries. Previously on this blog we&rsquo;ve discussed the setup required when using Visual Studio 2013 with both of these libraries (<a href=\"http:\/\/blogs.msdn.com\/b\/visualstudio\/archive\/2015\/02\/05\/using-angularjs-in-visual-studio-2013.aspx\">using AngularJS in VS<\/a>, <a href=\"http:\/\/blogs.msdn.com\/b\/visualstudio\/archive\/2015\/04\/20\/using-requirejs-with-visual-studio.aspx\">using RequireJS in VS<\/a>). In Visual Studio 2015, the support is baked in, with no additional setup steps required.<\/p>\n<p>Whenever you reference the angular.js (or angular.min.js) library in your code, editor automatically provides IntelliSense, Go to Definition, and navigation bar support:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/3323.IntellISenseforAngularJS_thumb_062D4DD7.png\"><img decoding=\"async\" style=\"float: none;margin-left: auto;margin-right: auto;border-width: 0px\" title=\"IntellISense for AngularJS\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/3323.IntellISenseforAngularJS_thumb_062D4DD7.png\" alt=\"IntellISense for AngularJS\" width=\"504\" height=\"246\" border=\"0\" \/><\/a><\/p>\n<p align=\"center\"><em>IntelliSense support for Angular 1.3, showing suggestions for the routeProvider service<\/em><\/p>\n<p>Similarly, RequireJS IntelliSense and navigation support are automatically enabled when you bring in the require.js library. To customize RequireJS support, see <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/mt125493(v=vs.140).aspx\">Customizing IntelliSense in RequireJS<\/a>.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/5315.RequireJSmodulereferences_06A8C26A.png\"><img decoding=\"async\" style=\"float: none;margin-left: auto;margin-right: auto;border-width: 0px\" title=\"IntelliSense suggestions for a module referenced using RequireJS\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/5315.RequireJSmodulereferences_06A8C26A.png\" alt=\"IntelliSense suggestions for a module referenced using RequireJS\" width=\"504\" height=\"73\" border=\"0\" \/><\/a><\/p>\n<p align=\"center\"><em>IntelliSense suggestions for a module referenced using RequireJS<\/em><\/p>\n<h2>JSDoc documentation comments<\/h2>\n<p>Documentation comments are a great tool for providing detailed information about APIs in your application. They can also help you guide Visual Studio to provide better IntelliSense suggestions as you write code. In Visual Studio 2015, the editor now understands <a href=\"http:\/\/usejsdoc.org\">JSDoc-style documentation comments<\/a> and can use them to improve your coding experience. JSDoc has become the unofficial standard for JavaScript comments on the web, and they&rsquo;re used in libraries like <a href=\"http:\/\/www.angularjs.org\">Angular<\/a> and <a href=\"http:\/\/www.emberjs.com\/\">Ember<\/a>. Here&rsquo;s a quick example using these comments and showing IntelliSense tooltip support to document a <span style=\"font-family: Consolas;font-size: x-small\">getPhotos()<\/span> function.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/2047.JSDoccommentsdisplayedinIntelliSensetooltips_thumb_4D1541E4.png\"><img decoding=\"async\" style=\"float: none;margin-left: auto;margin-right: auto;border-width: 0px\" title=\"JSDoc comments displayed in IntelliSense tool tips\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/2047.JSDoccommentsdisplayedinIntelliSensetooltips_thumb_4D1541E4.png\" alt=\"JSDoc comments displayed in IntelliSense tool tips\" width=\"554\" height=\"242\" border=\"0\" \/><\/a><\/p>\n<p align=\"center\"><em>JSDoc comments displayed in IntelliSense tool tips<\/em><\/p>\n<p>When you reference parameter types in comments (such as Array, above) you can use standard built-in JavaScript types and objects, such as String, Number, or Array. You can also define a custom object, which is useful for documenting parameters with custom properties, such as configuration settings. In the example below, you can see suggestions for an options object that may be passed to the <span style=\"font-family: Consolas;font-size: x-small\">savePhoto()<\/span> function.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/7750.ObjectliteralIntelliSense_thumb_3ACC7B22.png\"><img decoding=\"async\" style=\"float: none;margin-left: auto;margin-right: auto;border-width: 0px\" title=\"Documenting configuration objects using JSDoc\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/7750.ObjectliteralIntelliSense_thumb_3ACC7B22.png\" alt=\"Documenting configuration objects using JSDoc\" width=\"644\" height=\"241\" border=\"0\" \/><\/a><\/p>\n<p align=\"center\"><em>Documenting configuration objects using JSDoc<\/em><\/p>\n<p>In addition to JSDoc comments, <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/bb514138(v=vs.140).aspx\">XML-style documentation comments<\/a> continue to be supported as they were in Visual Studio 2013. A full list of the <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/mt162307(v=vs.140).aspx\">JSDoc tags supported by the editor<\/a> may be found on MSDN.<\/p>\n<h2>New language and browser features<\/h2>\n<p>As language standards and web APIs evolve, the JavaScript editor is also updated to keep pace. In this release we introduce further support for new language features in the <a href=\"http:\/\/wiki.ecmascript.org\/doku.php?id=harmony:specification_drafts\">ES2015 standard<\/a> (formerly known as ES6) and a set of new DOM APIs. These updates match the same features found in the recently announced <a href=\"http:\/\/windows.microsoft.com\/en-us\/windows\/preview-microsoft-edge-pc\">Microsoft Edge web browser<\/a>.<\/p>\n<h2>ECMAScript 2015 (formerly ECMAScript 6) support<\/h2>\n<p>Like the Microsoft Edge browser, which <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/br212465(v=vs.94).aspx\">now supports a large set of ES2015 features<\/a>, the Visual Studio JavaScript editor also supports a majority of ES2015Specifically, Visual Studio 2015 provides support for:<\/p>\n<ul>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/dn802832(v=vs.94).aspx\">Classes<\/a><\/li>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/yh6c50h7(v=vs.94).aspx#Arrow\">Arrow functions<\/a> (also known as lambdas)<\/li>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/dn858580(v=vs.94).aspx\">Template strings<\/a><\/li>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/yh6c50h7(v=vs.94).aspx#Rest\">Rest<\/a>\/<a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/dn919259(v=vs.94).aspx\">spread<\/a> operators<\/li>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/202863ha(v=vs.94).aspx\">Object literal enhancements<\/a><\/li>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/dn911714(v=vs.94).aspx\">Proxies<\/a><\/li>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/dn919632(v=vs.94).aspx\">Symbols<\/a><\/li>\n<li>New ES2015 APIs such as Map, Set, Weakmap, Weakset, Promises, and a variety of other <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/br212465(v=vs.94).aspx\">API changes<\/a><\/li>\n<\/ul>\n<p>This allows you to now write code such as the following:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/0486.UsingnewlanguagefeaturesinES2015_thumb_619A9162.png\"><img decoding=\"async\" style=\"float: none;margin-left: auto;margin-right: auto;border-width: 0px\" title=\"Using new language features in ES2015\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/0486.UsingnewlanguagefeaturesinES2015_thumb_619A9162.png\" alt=\"Using new language features in ES2015\" width=\"554\" height=\"202\" border=\"0\" \/><\/a><\/p>\n<p align=\"center\"><em>Using new language features in ES2015<\/em><\/p>\n<p>Notice the class keyword used for the <span style=\"font-family: Consolas;font-size: x-small\">LayoutManager<\/span> class, a template string for the message variable, and finally an arrow function used as the second argument to the <span style=\"font-family: Consolas;font-size: x-small\">addEventListener <\/span>API to define a function callback. To learn more, check out the set of learning materials being collected over in Eric Douglas&rsquo; <a href=\"https:\/\/github.com\/ericdouglas\/ES6-Learning\">ES6 Learning<\/a> repository on GitHub or review the <a href=\"http:\/\/wiki.ecmascript.org\/doku.php?id=harmony:specification_drafts\">specification for the ES2015 version of JavaScript<\/a>.<\/p>\n<p>You may have noticed that some ES2015 features aren&#8217;t supported yet, such as modules. We&rsquo;ve heard from you that <a href=\"http:\/\/visualstudio.uservoice.com\/forums\/121579-visual-studio\/suggestions\/7017377-support-for-es6-modules\">support for the latest ES2015 language features is important<\/a> and we&rsquo;re looking to support the full ES2015 specification as soon as possible.<\/p>\n<h2>IntelliSense for new web browser APIs<\/h2>\n<p>Visual Studio 2015 also provides IntelliSense support for new web browser APIs available in Microsoft Edge. Here are a few API highlights:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.w3.org\/TR\/touch-events\/\">Touch Events<\/a><\/li>\n<li><a href=\"https:\/\/docs.webplatform.org\/wiki\/apis\/webaudio\">Web Audio API<\/a><\/li>\n<\/ul>\n<p>You can see a full list of APIs supported by visiting the <a href=\"http:\/\/status.modern.ie\">http:\/\/status.modern.ie<\/a> website and filtering to <a href=\"https:\/\/status.modern.ie\/?iestatuses=iedev,implemented&amp;browserstatuses=notsupported,indevelopment,implemented&amp;browsers=chrome,firefox,opera,safari&amp;ieversion=11\">APIs available in the preview release<\/a>.<\/p>\n<h2>Working in complex JavaScript code<\/h2>\n<p>Finally, we&rsquo;ve heard from developers that when working in complex JavaScript source it can be difficult to find your way through the code. There are two editor features that have been added to help you discover important comments and APIs in your JavaScript source so you can more easily navigate through your code.<\/p>\n<h2>Task list<\/h2>\n<p>You can <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/txtwdysk(v=vs.140).aspx\">use the Visual Studio task list<\/a> to keep track of \/\/ TODO, \/\/ HACK, \/\/ UNDONE, or custom comment tokens in your source. This can help to surface technical debt and possible issues in your code.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/2262.TODO_668DB5AC.png\"><img decoding=\"async\" style=\"float: none;margin-left: auto;margin-right: auto;border-width: 0px\" title=\"Viewing TODO and HACK comments in the Task List\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/2262.TODO_668DB5AC.png\" alt=\"Viewing TODO and HACK comments in the Task List\" width=\"554\" height=\"207\" border=\"0\" \/><\/a><\/p>\n<p align=\"center\"><em>Viewing TODO and HACK comments in JavaScript source, using the Task List<\/em><\/p>\n<h2>Navigation bar<\/h2>\n<p>The navigation bar is enabled for the JavaScript editor with support for the common design patterns and libraries used by JavaScript developers. This helps you jump to identifiers you&rsquo;re frequently using in your code and reduces the time you have to spend visually scanning your source files.<\/p>\n<p>In the following example you can see how the editor understands ECMAScript 5 source:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/0118.NavBar1_4672A8EF.png\"><img decoding=\"async\" style=\"float: none;margin-left: auto;margin-right: auto;border-width: 0px\" title=\"Using the navigation bar to browse JavaScript source, written using ES5\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/0118.NavBar1_4672A8EF.png\" alt=\"Using the navigation bar to browse JavaScript source, written using ES5\" width=\"554\" height=\"227\" border=\"0\" \/><\/a><\/p>\n<p align=\"center\"><em>Using the navigation bar to browse JavaScript source, written using ES5<\/em><\/p>\n<p>And in another example, you can see that the navigation bar supports the new ES2015 class keyword (which greatly simplifies the equivalent prototype syntax in the previous example):<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/5430.NavBar2_5444EEEA.png\"><img decoding=\"async\" style=\"float: none;margin-left: auto;margin-right: auto;border-width: 0px\" title=\"Using the navigation bar to browse JavaScript source, written using ES2015\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/5430.NavBar2_5444EEEA.png\" alt=\"Using the navigation bar to browse JavaScript source, written using ES2015\" width=\"554\" height=\"290\" border=\"0\" \/><\/a><\/p>\n<p align=\"center\"><em>Using the navigation bar to browse JavaScript source, written using ES2015<\/em><\/p>\n<h2>Looking ahead<\/h2>\n<p>In addition to the features highlighted here, there are a variety of bug fixes, performance improvements, and other updates to help give you a first class JavaScript editor experience. Going forward, we&rsquo;ll continue to expand the editor to help build large scale JavaScript solutions.<\/p>\n<p>We also know how important it is to you to have an editor that supports the latest changes in the JavaScript language, such as ES2015 modules and generators, and we&rsquo;re working to make sure Visual Studio has great support for them.<\/p>\n<p>To try these features, <a href=\"https:\/\/www.visualstudio.com\/en-us\/downloads\/visual-studio-2015-downloads-vs.aspx\">download Visual Studio 2015<\/a> today. If you&rsquo;re an open source developer, student, hobbyist, or work in a small professional team, check out the free <a href=\"https:\/\/www.visualstudio.com\/vs-2015-product-editions\">Visual Studio 2015 Community edition<\/a>. Let us know how well the JavaScript editor works for you by <a href=\"https:\/\/connect.microsoft.com\/VisualStudio\/content\/content.aspx?ContentID=31113\">sending us a smile or frown<\/a>. You can also add your votes for future JavaScript tooling on our <a href=\"http:\/\/visualstudio.uservoice.com\/forums\/121579-visual-studio\/category\/31477-languages-javascript\">UserVoice site<\/a>.<\/p>\n<table style=\"width: 668px\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"126\"><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/2086.JordanMatthiesen_thumb_1AB29D55.jpg\"><img decoding=\"async\" style=\"border-width: 0px\" title=\"Jordan Matthiesen\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2015\/06\/2086.JordanMatthiesen_thumb_1AB29D55.jpg\" alt=\"Jordan Matthiesen\" width=\"130\" height=\"130\" border=\"0\" \/><\/a><\/td>\n<td valign=\"top\" width=\"540\"><strong>Jordan Matthiesen<\/strong> &ndash; Program Manager, Visual Studio JavaScript tools team <br \/><a href=\"http:\/\/www.twitter.com\/JMatthiesen\">@JMatthiesen<\/a><\/p>\n<p>Jordan has been at Microsoft for 3 years, working on JavaScript tooling for web and mobile application developers. Prior to this, he worked for 14 years developing web applications and products using ASP.NET\/C#, HTML, CSS, and lots and lots of JavaScript.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>JavaScript is an important technology for development on many different platforms, including web, mobile app, and server programming. In Visual Studio 2013 we already support IntelliSense, Go to Definition, colorization, and formatting of JavaScript source, along with several other features. We&rsquo;ve carried these forward into Visual Studio 2015 and we&rsquo;ve improved the experience for JavaScript [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":255385,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[4980,1028,561,155,1029],"tags":[237,223,85,5,136,137,376,124,196],"class_list":["post-3681","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","category-mobile","category-open-source","category-visual-studio","category-web","tag-net","tag-angularjs","tag-asp-net","tag-csharp","tag-css","tag-html","tag-java","tag-javascript","tag-visual-studio-2015"],"acf":[],"blog_post_summary":"<p>JavaScript is an important technology for development on many different platforms, including web, mobile app, and server programming. In Visual Studio 2013 we already support IntelliSense, Go to Definition, colorization, and formatting of JavaScript source, along with several other features. We&rsquo;ve carried these forward into Visual Studio 2015 and we&rsquo;ve improved the experience for JavaScript [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/3681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=3681"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/3681\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/255385"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=3681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=3681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=3681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}