Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2015 - Javascript ES6 not working

I am playing around with VS 2015 JavaScript/NodeJS IDE and I plan to use ES6 as the language style for JavaScript, however I am noticing that Visual Studio is not recognizing the ES6 (even though I read on various web sites that VS should recognize ES6).

Does anyone know how to make VS 2015 play nice (both in syntax highlighting, intellisense, etc) with ES6?

es6-errors

I also modified the file extension to be .JSX and .ES6 in case that would help VS pick up on it. No luck...

like image 435
E.S. Avatar asked Oct 19 '15 21:10

E.S.


People also ask

Can we use ES6 in JavaScript?

JavaScript ES6 (also known as ECMAScript 2015 or ECMAScript 6) is the newer version of JavaScript that was introduced in 2015. ECMAScript is the standard that JavaScript programming language uses. ECMAScript provides the specification on how JavaScript programming language should work.

Do all browsers support ES6 now?

All the current browsers have full support to ES6.

Does JavaScript work on Visual Studio?

Visual Studio provides an out of the box, first class debugging experience for JavaScript. Powerful features like source maps allow you to drop breakpoints directly in your code.


2 Answers

If you want IntelliSense for ES6 in a nodejs project, then you need to turn on a particular setting.

Open Tools → Options → Text editor → Node.js → IntelliSense and select the ES6 IntelliSense Preview checkbox.

In the December 2015 version of the tools, there is a link to additional notes about the prerequisites, such as having to install TypeScript for Visual Studio 2015 so that ES6 IntelliSense works.

like image 93
Don Avatar answered Oct 18 '22 23:10

Don


@Shawn, in order to enable the Node.js options (and ES6 IntelliSense) you need to install the Visual Studio NodeJS Tools: https://www.visualstudio.com/en-us/features/node-js-vs.aspx

like image 3
Jose Marcenaro Avatar answered Oct 18 '22 23:10

Jose Marcenaro