eclipse-wildwebdeveloper / wildwebdeveloper

Simple and productive Web Development Tools in the Eclipse IDE
https://projects.eclipse.org/projects/tools.wildwebdeveloper
Eclipse Public License 2.0
189 stars 70 forks source link

ECMAScript 2017 Async/Await - Error "Semi-colon expected" #485

Closed Uros-V closed 4 years ago

Uros-V commented 4 years ago

According to https://marketplace.eclipse.org/content/wild-web-developer-web-development-eclipse-ide WWD currently supports JavaScript (EcmaScript 2018 - 9th edition) so it shouldn't have any trouble Async/Await that was added in ECMAScript 2017 - 8th edition, . Unfortunately it does have a problem because when I try using it: "Semi-colon expected" error pops up.

// example

async function asyncFunction() {

  let promise = new Promise((resolve, reject) => {
    setTimeout(() => resolve("done!"), 1000)
  });

  let result = await promise; // wait until the promise resolves (*)

  alert(result); // "done!"
}

async-await

I'm using: Eclipse IDE for Enterprise Java Developers , Version: 2020-06 (4.16.0) Wild Web Developer , Version: 0.10.1.202007101231 *.js files are associated with Generic Text Editor

I can successfully export my war , deploy it and everything works fine, but the false errors in the IDE aren't going anywhere making it a horrible IDE experience.

PS The github page doesn't claim WWD supports EcmaScript 2018 - 9th edition, but then again it doesn't say anything about which version it supports (just says "JavaScript / ECMAScript").

mickaelistria commented 4 years ago

I think you have the JavaScript Development Tools project installed and causing you trouble (as this one doesn't support newer JS). Go to Help > About > Installation Details > Installed Software, look for "JavaScript Devcelopment Tools" and uninstall it. I don't think this issue is caused by Wild Web Developer, so I'm closing it. Please add details to reopen it if your futher experiments seem to confirm WIld Web Developer is to blame.

Uros-V commented 4 years ago

Hi, just a follow up. I did some more tests and you are definitely correct, the problem isn't caused by WWD but it seems to be caused by "Eclipse Enterprise Java Developer Tools 3.18" that comes bundled with "Eclipse IDE for Enterprise Java Developers" 2020-06.

Forgot to include all the steps to reproduce the error in my original post, writing them now because the validator doen't seem to fire up if the JS file is placed in src of a new simple Java Project. Here is a quick way of replicating the error: 1) Get Eclipse IDE for Enterprise Java Developers 2020-06 2) File -> New -> Maven Project -> Next -> fish.payara.maven.archetypes -> (set Group id, Artefact id) Finish 3) Place a JavaScript file with async/await in src -> main -> webapp, hit save and the errors will popup.

I've tried the normal "Eclipse IDE for Java Developers" 2020-06, installed WWD and "Eclipse Web Developer Tools 3.18" plugins - no validation errors about async/await.

Now back to "Eclipse Enterprise Java Developer Tools 3.18", I tried to follow your suggestion and remove "Eclipse Java Web Developer Tools - JavaScript support" but unfortunately it is flagged as required and can't be removed without removing the whole plugin: cant_remove That plugin in my case has to stay (mainly for JSP and taglib support), so for now the only solution I see is to turn off JavaScript validation ( Preferences -> Valdiation -> JavaScript Validation [off] [off] ). Code highlighting and auto completion will still work , the Language Server will still catch the obvious errors (like missing curly braces or unterminated string literals).

Thank you for pointing me in the right direction and your time. This issue should remain closed here.

mickaelistria commented 4 years ago

Disabling JSDT validation is a good trick.

C4J commented 3 months ago

I tried using the regular java IDE which fixed the syntax error messages but I was not able to run my project as on a server.

I then reverted to the EE edition of Eclipse and disabled javascript validation - thinking that maybe WildWeb would do the validation instead - but then the editor would let my type anything and not query it.

If I'm missing something let me know. I'm using the 2024 06 version on a Mac.