Feel free to download.
It's a little bit out of step with imminent V1.1.0 release of node-red.
I'm just waiting until it's released as the Devs are moving things very quickly at the moment.
But my all means you can co-contribute - pm me your email and I'll add you as an admin on the repo (if you want)
On v1.0.6 the only remaining issue was the documentation toolbar not correctly placing cursor after applying markdown formatting.
Everything else worked.
So I'd say it was 99% done (minus the bugs I don't know about)
There were additional TODOs tho like more snippets, better jsdoc for existing node-red bits that get injected into the functions VM (like global, flow, RED etc)
All fair game if you wanna give it a bash.
And I might add, you'll likely better know how to host it properly (you'll see how I shoe horned it in to grunt) so I'd appreciate you looking at that too.
1 Like
I'm new on here so can't PM you, but you can try to PM me, or add my GitHub username: rjamesnw as admin on the project as suggested, thanks.
Collaboration invite sent James.
Ok, I went through all your commits and reviewed the code. I think I have a handle on it all now. That said, it seems JavaScript focused for Function nodes, and I wanted TypeScript (yes, I can switch the mode), but I want JS output at the same time (so both), which works in my POC. I'm thinking to create a new branch instead to play with another idea, which is to keep ACE for the Function node (for any JS editing), and have a tab/toggle for TS instead (as shown in my initial screenshot earlier of my version of it). Editing in TS will lock ACE to read-only, and allows editing with static type checking and all the other fancy TS stuff (interfaces, etc.).
I think we are going a bit off topic here, so I think it is better to discuss this in a separate post.
Why not your own custom node-red-contrib-typescript node apart from the current function node (which stays dedicated to javascript)?
1 Like
I didnât want to re-invent the wheel since the function node already existed, and I didnât want a âFunctionâ node vs a âTypeScriptâ node because that might be confusing, but yes, I could just duplicate the node I guess.
1 Like
@Steve-Mcl Iâm planning to convert your code into a TypeScript class, and place it into a separate file that can integrate with the editor without messing around to much with editor.js file. Would you prefer I create a new branch for that, or fork the repo specifically for TypeScript? My version of it was already a class. I would be adding your code to mine to speed up the process.
Hack away James.
A branch would be good but proceed as you see fit James.
Ok, I'll branch from it to give some ideas a try, thanks.
I think that the point here is that most of us are JavaScript people not Typescript. So anything that was limited to TS only wouldn't be of much use to most of us I'm afraid.
TypeScript is JavaScript with static typing added to make catching compile time errors, instead of runtime bugs. It's not a different language.
I know what it is.
But I don't entirely agree with you. In fact is is a different language with some quite different expectations and syntax in places. That it transpiles to JavaScript code is neither here nor there.
As has been said elsewhere, for many of us, TS isn't needed or wanted because we tend to write smaller amounts of code when using Node-RED since NR does a lot of the heavy lifting.
This isn't a commentary as to whether TS is better/worse than JS, it is simply different with a different focus.
My point was that if there were to be a function node that used Monaco as the editor, it would be a lot less useful if it could only deal with TS. If you wanted a TS specific node, then that's great for those that want it, no problem.
6 Likes
Steve, which upstream version is the current monaco branch based on, by the way? I just installed it on my experimenting/dev machine to see if some ace specific issues for tablet (iPad pro 2nd gen, iOS 13) use were fixed by switching to monaco. Since I can now select text, cut, copy and other useful things I consider that a go, at least for developing-from-bed today. Since these same problems I experienced are seen in upstream ace too, just pushing ace to the latest version wouldnât have helped.
Iâm spotting a couple things on iOS usage, will keep this post updated throughout the day as I go.
- Dragging around in the editor to scroll works, but the browser (Safari 13) seems to think I want to refresh the page so not pulling too hard.
- Depending on position/size of the editor, the right mouse button/long press context menu does not fit in view and which part is shown depends on position in visible part. Compare
- Pressing âcopyâ from the context menu does not appear to actually copy the text to clipboard. Upon paste in switch node I find a flows file I exported to clipboard earlier dumped in. Could be due to native handling, Iâll see if I can find this on monaco level later.
- Full screen editor option doesnât work on iOS. Just verified ACE (on 1.0.6) has the same issue so Iâll check the NR bugtracker for this. No difference between split view/full view in behaviour. Monaco is actually more useable here, believe it or not...
Edit: This appears to be a uibuilder specific issue. It works fine with nodes that use the regular expand
handling from the core for editors. This has now been reported to Uibuilder as issue 93.
2 Likes
On Android select/cut/copy/paste do work on ACE. If using an alternative virtual keyboard like Hacker's keyboard, it's even possible to use keyboard shortcuts. But if the code is longer than what fits above the keyboard, it will disappear behind it unless I add lots of empty lines in the end of the code.
Hi Lena,
my apologies - i did not spot this post until moments ago.
As of 10 mins ago - this branch is bang up to date with the dev branch (which is only just slightly ahead and slightly behind master).
There has been no real update to monaco so nothing has changed with regards to the issues you have seen.
However I have updated the branch to work with new function node multiple editors (Nick is calling a function in ACE that I hadnt proxied / wasnt used by other nodes (moveCursorTo()
))
Current status - pretty much as before but now working with latest node-red & every node I opened (all core + some of the more popular contrib nodes + my own contrib nodes (obvs) )
4 Likes
Hi Steve, this editor could really be a great help for me.
In my opinion it seems to be ready to create a pull request, and have it reviewed?
Perhaps there are some things nobody thought about, but then at least you know it and you can try to fix it.
Because due to the high number of new discussions lately on the forum, I'm afraid it will get lost here. Must admit that I already forgot it ...
1 Like
At the time of writing, I think 1.1.0 was in its second beta and I wondered if the dev updates had been merged with the branch, and couldnât verify the source of issues I was seeing as perhaps they were already fixed upstream. Since ace editor has compatibility issues between platforms that appear to be slow/wonât fix, to me monaco is a good alternative for days where I work on flows from bed with just a tablet.
1 Like
It should be pretty straight forward to merge with master as they are very close at present.
Are you going to give it another go Lena? Would be great to see your (new) feedback (I'll watch out for the notification this time )
This isn't going anywhere near master
in the first instance - new features should be targeted at the dev
branch.
That said, I'm not sure whether this will go into 1.x, or will have to wait until 2.x. It is a major change to a key dependency and for all of the good testing you've done, we can't be sure this still won't break some nodes out there. We also have to consider the companies who embed Node-RED into their own services and what sort of stability they should expect between major releases.
One option to get it into a 1.x release would be to have it completely disabled by default and have it enabled by a feature flag in the settings file. That way it can be flagged as an experimental, opt-in, feature.
3 Likes