JS editor code completion / templates

Hi all,

I am running NR v.1.0.3 and think im going crazy.

As far as i remember from earlier versions ~0.15->0.18, whenever i was editing javascript in the function node editor, i could press ctrl-space and get a dropdown with code-templates. Not just keywords, but full code templates with many examples of typical code patterns; for-loops, switch-structures ect.

I cannot find any hotkeys, documentation, config-settings, or anything in this regard. Also I cannot make Internet come up with any information on this.

Is my memory that bad, or is the function removed and nobody talks about it?

Regards
Anders

You mean like this:
Screen Shot 2020-01-26 at 5.30.03 AM
Works for me
NR: v1.0.3
node.js: v12.13.0
Check your keyboard??

That also works for me. I'm missing code templates. It used to be like for example when i type

swit___

It came up with multiple prefilled codepattern suggestions like...
switch( expression ) {case x :code block break;...

I am almost 100% certain it worked like that "back in the days"

You mean this I think - the templates are provided via the library feature:

image

Thank you all for replying...

No i am not thinking of the library. It is called code templates in many editors. In Eclipse it is described here:
https://www.tutorialspoint.com/eclipse/eclipse_code_templates.htm

I am extremely sure it was a feature in earlier versions of node red. I think i will have to find an earlier version just to prove i am not loosing my mind :slight_smile:

No. @aolsendk is referring to the 'snippets' support in the editor.

I agree, the snippets aren't there in Node-RED 1.0. Snippets are still enabled by default and the snippet files are all there - node-red/packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets at master · node-red/node-red · GitHub

Ahhh - as I write this I realise what has happened. We introduced a custom version of the standard JavaScript mode for the Function node so it would be aware of the Node-RED specifics. But that mode doesn't include any snippets.

Please raise an issue and we can update the custom mode to include snippets.

4 Likes

Haha, I don't think I ever even noticed them!! :frowning:

1 Like

Done.. and thank you for all the great work.

Is code completion available? I don't see it when working with the function node editor.

1 Like