How to make JavaScript IDEs like VSCode or WebStorm to be as intelligent on code completion as Eclipse?

Nublia :

When I'm writing JavaScript using IDEs like VSCode or WebStorm, I feel it's not as intelligent on code completion as Eclipse.

For example when I write Java using Eclipse. It's intelligent code completion feature will tell me where it will have error, without run it (possible it runs at background, but I don't need to press the run button).

But in some similar cases in VSCode or WebStorm, it does not show me the error. I need to press the run button, run it by hand, and get an error.

Like the following JavaScript code, the last one will be error after run it, but VSCode does not tell. But similar cases in Java in Eclipse will show error right away.

Also, after I type the last "." VSCode's code completion still shows the "__proto__". But similar cases in Eclipse, if the code will be error, after I type the ".", its code completion feature will not show that thing.

           function MyClass(){

           };
           var mc = new MyClass();
           console.log(mc);
           console.log(mc.__proto__);
           console.log(mc.__proto__.__proto__);
           console.log(mc.__proto__.__proto__.__proto__); //null
           console.log(mc.__proto__.__proto__.__proto__.__proto__); //Will get error

How to make VSCode or WebStorm to show error right away?
How to make these to not show that thing that will cause error after I type "."?
If VSCode or WebStorm can not do these, are there any IDEs can do this?

Christopher Taleck :

Comparing the experience in an IDE for Java (a type-safe language) and JavaScript (a dynamic-type language) may not be a fair comparison. However, there are some things you can do to make it better.

For example in VS Code, the documentation suggests the following:

While IntelliSense should just work for most JavaScript projects without any configuration, you can make IntelliSense even more useful with JSDoc or by configuring a jsconfig.json project.

Further, your specific example will not be helped by more configuration as every object in JavaScript contains the __proto__ property. See MDN.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=308889&siteId=1