# JS editor code completion / templates

**URL:** https://discourse.nodered.org/t/js-editor-code-completion-templates/20863
**Category:** General
**Created:** [26 January 2020 09:50 UTC](https://discourse.nodered.org/t/js-editor-code-completion-templates/20863 "2020-01-26T09:50:35Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![aolsendk](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@aolsendk](https://discourse.nodered.org/u/aolsendk)
#### Post date: [26 January 2020 09:50 UTC](https://discourse.nodered.org/t/js-editor-code-completion-templates/20863/1 "2020-01-26T09:50:35Z")

</div>

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

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [26 January 2020 10:31 UTC](https://discourse.nodered.org/t/js-editor-code-completion-templates/20863/2 "2020-01-26T10:31:49Z")

</div>

You mean like this:  
 ![Screen Shot 2020-01-26 at 5.30.03 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/2/62b83badf4388926fd09bb738d85a6b209161892.png)  
Works for me  
NR: v1.0.3  
node.js: v12.13.0  
Check your keyboard??

---

<div class="post-metadata">

### Author: ![aolsendk](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@aolsendk](https://discourse.nodered.org/u/aolsendk)
#### Post date: [26 January 2020 10:47 UTC](https://discourse.nodered.org/t/js-editor-code-completion-templates/20863/3 "2020-01-26T10:47:58Z")

</div>

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"

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [26 January 2020 11:19 UTC](https://discourse.nodered.org/t/js-editor-code-completion-templates/20863/4 "2020-01-26T11:19:13Z")

</div>

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

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/0/0034c61e456695136460ef7d1288638c3f8db15c.png)

---

<div class="post-metadata">

### Author: ![aolsendk](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@aolsendk](https://discourse.nodered.org/u/aolsendk)
#### Post date: [26 January 2020 11:38 UTC](https://discourse.nodered.org/t/js-editor-code-completion-templates/20863/5 "2020-01-26T11:38:19Z")

</div>

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](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 🙂

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [26 January 2020 11:43 UTC](https://discourse.nodered.org/t/js-editor-code-completion-templates/20863/6 "2020-01-26T11:43:10Z")

</div>

> [@TotallyInformation](#):
>
> You mean this I think - the templates are provided via the library feature

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/0/d0662f81ec824928fa7ad2b63a6140df4780a747.png)

I agree, the snippets aren't there in Node-RED 1.0. Snippets are still [enabled by default](https://github.com/node-red/node-red/blob/master/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js#L2462) 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](https://github.com/node-red/node-red/tree/master/packages/node_modules/%40node-red/editor-client/src/vendor/ace/snippets)

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.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [26 January 2020 11:44 UTC](https://discourse.nodered.org/t/js-editor-code-completion-templates/20863/7 "2020-01-26T11:44:33Z")

</div>

> [@knolleary](#):
>
> No.

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

---

<div class="post-metadata">

### Author: ![aolsendk](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@aolsendk](https://discourse.nodered.org/u/aolsendk)
#### Post date: [26 January 2020 11:56 UTC](https://discourse.nodered.org/t/js-editor-code-completion-templates/20863/8 "2020-01-26T11:56:21Z")

</div>

> [@knolleary](#):
>
> Please raise an issue and we can update the custom mode to include snippets.

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

---

<div class="post-metadata">

### Author: ![jamesnw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jamesnw/32/23470_2.png) [@jamesnw](https://discourse.nodered.org/u/jamesnw)
#### Post date: [7 June 2020 03:06 UTC](https://discourse.nodered.org/t/js-editor-code-completion-templates/20863/9 "2020-06-07T03:06:14Z")

</div>

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