Making VS Code recognize full ES6 syntax

Issue

VS Code doesn’t recognize :: as valid syntax, as in

render() {
    return (
        <button
          className="btn btn-primary"
          onClick={::this.handleClick}>
        Click me
        </button>
    );
}

It highlights :: with an error [js] identifier expected and thus invalidates the whole file.

An ideas how to remedy that – make VS Code respect ES6 syntax?

Solution

Use extentions

Your code looks like React to me, so you could try https://marketplace.visualstudio.com/items?itemName=dzannotti.vscode-babel-coloring which could help with React style code and ES6/ES7

Furthermore, you can modify extention to suit your needs

Answered By – v-andrew

Answer Checked By – Marie Seifert (AngularFixing Admin)

Leave a Reply

Your email address will not be published.