Search code examples
javascriptnetbeansnetbeans-16

How can I add new syntax to an existing language in Netbeans IDE 16?


Netbeans considers for await syntax to be invalid. The error hint indicates: "Expected ( but found await". Source > Format will not work as expected while the for await remains.

Is there a way to update the existing syntax checker for .js files to mark for await as valid syntax, so that the code formatter will work correctly again?

I tried to review FAQs on the official site for Netbeans. All the relevant questions lead to page not found dead ends.

I tried to go to Tools > Options > Miscellaneous > Files to edit the associated file config for js which defaults to text/karmaconf+javascript. It's possible to change the file type, but not to edit the existing one. I searched the netbeans program files path for the config file to update it manually, but I don't quite know how to find it.


Solution

  • I can reproduce your issue in NetBeans 16, and it has already been bug reported. See NetBeans Bug Report #4757 JavaScript to support "for await of" #4757.

    You could opt to filter out the parsing error:

    forAwait

    However, that approach would probably cause more problems that it would solve. While it would make that "Expected ( but found await" message go away, at a minimum it would also impact the parsing of the entire file, and would not impact formatting at all. (I realize that was not part of your question, and mention it only for completeness.)

    Apart from that, all you can really do is update the bug report to voice your concern in the hope that it increases the priority of fixing the bug.

    Unfortunately I don't see any way to resolve the issue through configuration changes in NetBeans.