# Autocomplete of the message object in a function node

**URL:** https://discourse.nodered.org/t/autocomplete-of-the-message-object-in-a-function-node/79031
**Category:** Feature Requests
**Created:** [7 June 2023 17:08 UTC](https://discourse.nodered.org/t/autocomplete-of-the-message-object-in-a-function-node/79031 "2023-06-07T17:08:33Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![christopher-lambe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christopher-lambe/32/69369_2.png) [@christopher-lambe](https://discourse.nodered.org/u/christopher-lambe)
#### Post date: [7 June 2023 17:08 UTC](https://discourse.nodered.org/t/autocomplete-of-the-message-object-in-a-function-node/79031/1 "2023-06-07T17:08:33Z")

</div>

Hi there,

You have a heavily loaded message object and the debug window is visible, maybe one message object is expanded.

You are in the function node writing some JS and need to reference one of the myriad of objects you placed in the message object.

Yes you can click "copy path" in the debug window(we all love it), but autocomplete would be so so much quicker and cooler. The autocomplete could use the objects found inside the message objects in the debug window as its source.

Cheers,

Chris

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [7 June 2023 17:42 UTC](https://discourse.nodered.org/t/autocomplete-of-the-message-object-in-a-function-node/79031/2 "2023-06-07T17:42:01Z")

</div>

~~You seem to have missed the copy value button, next to copy path.~~  
scratch that, did not see this is a feature request.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [7 June 2023 18:39 UTC](https://discourse.nodered.org/t/autocomplete-of-the-message-object-in-a-function-node/79031/3 "2023-06-07T18:39:14Z")

</div>

The issue is that the function node has no idea what message (or its contents) will arrive next (or in the future). It could literally be anything.

---

<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: [7 June 2023 18:39 UTC](https://discourse.nodered.org/t/autocomplete-of-the-message-object-in-a-function-node/79031/4 "2023-06-07T18:39:16Z")

</div>

How would your function node know which debug output object to select for auto-complete?

---

<div class="post-metadata">

### Author: ![christopher-lambe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christopher-lambe/32/69369_2.png) [@christopher-lambe](https://discourse.nodered.org/u/christopher-lambe)
#### Post date: [8 June 2023 07:08 UTC](https://discourse.nodered.org/t/autocomplete-of-the-message-object-in-a-function-node/79031/5 "2023-06-08T07:08:23Z")

</div>

The flow will of course have to be executed at least once before autosense can help itself to the goodies contained in the message object in the debug window. Just like the "copy path" is only useful after the flow has been executed.

---

<div class="post-metadata">

### Author: ![christopher-lambe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christopher-lambe/32/69369_2.png) [@christopher-lambe](https://discourse.nodered.org/u/christopher-lambe)
#### Post date: [8 June 2023 07:17 UTC](https://discourse.nodered.org/t/autocomplete-of-the-message-object-in-a-function-node/79031/6 "2023-06-08T07:17:24Z")

</div>

It would use all currently displayed message objects in the debug window. It would be up to the user to set a filter as needed in the debug window.

Another idea would be an "add this message object to autocomplete cache" button beside the "copy path", "copy value" and "Pin open" options on message objects in the debug window.

I like this second option. Thanks for challenging me on where to get the data.

Edit typo

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [8 June 2023 07:33 UTC](https://discourse.nodered.org/t/autocomplete-of-the-message-object-in-a-function-node/79031/7 "2023-06-08T07:33:46Z")

</div>

Where is the advantage time/click saving? If we have to click add to auto complete then select the auto to fill, i see no difference than copy value and paste direct from debug.

---

<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: [8 June 2023 08:33 UTC](https://discourse.nodered.org/t/autocomplete-of-the-message-object-in-a-function-node/79031/8 "2023-06-08T08:33:08Z")

</div>

I can see a rough path to making this work. The debug sidebar could certainly keep a record of the message properties it has seen whilst the editor is open - that would be better than nothing. The question would then be whether we're able to expose that in a way the monaco editor is able to pick up dynamically.... something to look for _after_ 3.1 is released.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [8 June 2023 08:58 UTC](https://discourse.nodered.org/t/autocomplete-of-the-message-object-in-a-function-node/79031/9 "2023-06-08T08:58:57Z")

</div>

Not designing now… but… here be dragons… re performance and fast moving debug flows, caching data volumes, discarding , etc

---

<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: [8 June 2023 12:22 UTC](https://discourse.nodered.org/t/autocomplete-of-the-message-object-in-a-function-node/79031/10 "2023-06-08T12:22:04Z")

</div>

> [@christopher-lambe](#):
>
> It would use all currently displayed message objects in the debug window. It would be up to the user to set a filter as needed in the debug window.

That could be hundreds or thousands. Filtering in the debug panel would be far from intuitive.

> [@christopher-lambe](#):
>
> Another idea would be an "add this message object to autocomplete cache" button beside the "copy path", "copy value" and "Pin open" options on message objects in the debug window.

That might work though the 3 existing icons are already rather crowded.

> [@dceejay](#):
>
> here be dragons… re performance and fast moving debug flows, caching data volumes, discarding , etc

Totally.

Worth a look certainly, would be potentially nice to have but not at the expense of performance and usability.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [7 August 2023 12:22 UTC](https://discourse.nodered.org/t/autocomplete-of-the-message-object-in-a-function-node/79031/11 "2023-08-07T12:22:42Z")

</div>

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