Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i write ECMAScript 6 in Visual Studio Code?

How can i write ECMAScript code in Visual Studio Code ?? I tried writing jsconfig.json but am not sure about how to run that file. I even tried changing the tasks.json but even that is not helping.

Thanks In Advance,

Amala

like image 631
Amala James Avatar asked Mar 01 '26 17:03

Amala James


1 Answers

Update April 2016:

As of the latest version of visual studio code (1.0 at time of writing)there should be no need for jsconfig.json to enable ES6 now.

Previous Answer:

  1. Create a new folder in your file system
  2. Open the folder in VS Code:
    Open folder
  3. When the folder is opened, click on the New File icon: New file
  4. Call the file jsconfig.json and paste the following config:
{
    "compilerOptions": {
        "target": "ES6"
    }
}

Now when you create a JS file, you'll get IntelliSense and ES6 code validation:

Example code

You can find out more about ES6 support from the VSCode Blog

like image 109
CodingIntrigue Avatar answered Mar 03 '26 14:03

CodingIntrigue