-->

Nodeclipse not recognizing generator functions

2019-08-10 21:05发布

问题:

First off, I am starting Node with the --harmony flag. I set this flag in Eclipse "Preferences > Nodeclipse > node options"

The problems show in the .js files themselves.

For instance, I have a generator method in one of my controllers...

show: function* () { ... }

Nodeclipse is showing an error on all .js files with generator functions. It displays the red "x" with the message...

Syntax error on "*".  Delete this token.

Since most of node modules I use have generator functions, I have like 500 errors in the project.

Anyone know how to fix this?

回答1:

a) get Nodeclipse 1.1 http://www.nodeclipse.org/history

or

b) do manually:

remove JSDT nature in .project

    <nature>org.eclipse.wst.jsdt.core.jsNature</nature>

in .jshintrc enable ES6

"esnext" : true, // Allow ES.next (ECMAScript 6) specific features such as `const` and `let`.