Using Monaco editor - monaco branch now in fork (PR#2971)

But to reiterate, we won't be exposing this as an option in the editor to begin with.

This is why it's worth getting a PR in early, to avoid time being spent on things we don't want to merge.

How would i implement this if im using the official docker image?

You will have to wait until it is integrated with node-red core then follow instructions that I imagine we will include. Until then, you could roll your own docker image off my fork but I dont have the required expertise to assist.

Update

I have been holding back due to a couple of things I didnt like...

  • The many files and hashed filenames that Parcel creates
  • Not having locales working for monaco menus

I think i have now cracked both of these...

image

Results...
image

image

image


Assuming I haven't introduced any issues, it is my intention to have the PR raised before 2021 (within 4 days :slight_smile: )

5 Likes

Pull request raised...

:crossed_fingers:

8 Likes

Hi Steve, just in case you need to know. I've made a small change in uibuilder v3.0.1 to the way the ACE editor is handled in uibuilder.html.

I'm now using RED.editor.editText, the same as Node-RED core nodes thanks to Lena who pointed me in the right direction.

I'll update and check (but I know that method definitely works)

Did you remember to not be so strict on the file type?

Oops! Knew there was something else to do :blush:

I'll remember to add that to the To Do list this time round. I'll add it in the next release. Thanks for the reminder.

Don't suppose you know how to list the available ACE modes do you?

I'm new to node-red, but I created an account just to comment here and say thanks for doing this! I'm excited to get those vscode keybindings.

3 Likes

Hi, sorry I missed this comment.

Thanks for the encouraging words.

If you are interested, there is info on this thread to permit you to install and test this branch for yourself. If you are willing? Always good to get feedback.

Cheers.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.

Hey @Steve-Mcl latest PR-2971 builds fine, but for me, hangs UI on start, with or without codeEditor in settings.

hi, there was an issue on dev branch that was fixed recently by Nick - it just hasnt been merged in.

I'll pull the upstream and merge dev - gimmie 2 mins.

Would be really good if you could take it for a drive and feedback any issues.

ok, so if you could ...

  • stop node-red
  • git checkout monaco2
  • git pull
  • npm run build
  • npm run start
  • Refresh browser

Let me know how you get on please.

So nice!

I'll test more extensively, but one thing that jumped out...

I used the monaco.languages.typescript.javascriptDefaults from the PR.

Everything looks fine in the function editor (I see expected validation issues, or no issues) but when I click Expand, I consistently get one of two validations errors:

Definitions of the following identifiers conflict with those in another file: HYSTERESIS, LOW_BATTERY_VOLTS, locations, notifyMsgs, sensors, getSensor, lostSensor, queueInflux, pushMqtt, notify, checkState, makeTable, soilBatteryUpdate, soilMoistureUpdate, stream(6200)

126(2, 1): Conflicts are in this file.

basically one error that includes every constant, or one these for each constant

Cannot redeclare block-scoped variable 'eventStates'.(2451)
196(2, 7): 'eventStates' was also declared here.

Hi can you share the flow that causes this?
Never mind, I see the issue and it's a doozy :sob:

1 Like

Hi @emes I have worked around the issue.

please pull & retry.

The issue is the singleton model of the javascript worker.

monaco is designed as a "project" editor where variables created in a project are "visible" to other "files" and therefore the error you see when multiple instances are created (i.e. the function node)

The workaround I have implemented is working well for me (though I dont love the solution - reading the issues on the repo, apart from creating the editor instances in an iframe, it is the only solution I could find).

Seems fairly stable but would really like some feedback?

Cheers.

Hi Steve, have you got any new info if or when we can expect it to be merged in an upcoming NR version? Or is it already there somewhere? I double checked my settings.js and the menu but I cannot see anything there. Using NR 1.3.4

Best regards, Walter

Hi Walter, so long as there are no major issues, Nick is going to merge into node-red V2 beta. Won't be long :crossed_fingers:

2 Likes