bartbutenaers / node-red-contrib-blockly

A Node Red node for visual programming a function using Blockly
Apache License 2.0
88 stars 22 forks source link

Javascript errors not visible #84

Closed bartbutenaers closed 3 years ago

bartbutenaers commented 3 years ago

I had following syntax error in the Node-RED startup log:

17 Jul 23:01:40 - [info] Starting flows
17 Jul 23:01:40 - [error] [Blockly:935786d92e05853b] SyntaxError: Unexpected token ';' (body:line 6)
17 Jul 23:01:40 - [info] Started flows

Seemed one of my new blocks was generating incorrect Javascript code, which resulted in this error.

Normally the generated Javascript code should NEVER contain errors, but you never know. In that case you should see visually that there is a problem.

I have pushed a change to show a red triangle, if the code contains a syntax error:

image

Would be nice if we could also highlight the error in our (readonly) Javascript error, but seems that Steve has to fix Node-RED first before we can do that.

bartbutenaers commented 3 years ago

Thanks to Nick and Steve (see here) our readonly Monaco editor can now also show the error markers:

image

The fix is pushed to Github