diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/code-editors/monaco.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/code-editors/monaco.js index 35ca607a0..0e17fec75 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/code-editors/monaco.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/code-editors/monaco.js @@ -577,7 +577,7 @@ RED.editor.codeEditor.monaco = (function() { createMonacoCompletionItem("set (flow context)", 'flow.set("${1:name}", ${1:value});','Set a value in flow context',range), createMonacoCompletionItem("get (global context)", 'global.get("${1:name}");','Get a value from global context',range), createMonacoCompletionItem("set (global context)", 'global.set("${1:name}", ${1:value});','Set a value in global context',range), - createMonacoCompletionItem("get (env)", 'env.get("${1:name}");','Get env variable value',range), + createMonacoCompletionItem("get (env)", 'env.get("${1|NR_NODE_ID,NR_NODE_NAME,NR_NODE_PATH,NR_GROUP_ID,NR_GROUP_NAME,NR_FLOW_ID,NR_FLOW_NAME|}");','Get env variable value',range), createMonacoCompletionItem("cloneMessage (RED.util)", 'RED.util.cloneMessage(${1:msg});', ["```typescript", "RED.util.cloneMessage(msg: T): T", diff --git a/packages/node_modules/@node-red/editor-client/src/types/node-red/func.d.ts b/packages/node_modules/@node-red/editor-client/src/types/node-red/func.d.ts index 6ac0d8b02..ae411f33c 100644 --- a/packages/node_modules/@node-red/editor-client/src/types/node-red/func.d.ts +++ b/packages/node_modules/@node-red/editor-client/src/types/node-red/func.d.ts @@ -263,6 +263,20 @@ declare class global { static keys(store: string, callback: Function); } declare class env { - /** Get an environment variable value */ - static get(name:string); + /** + * Get an environment variable value + * + * Predefined node-red variables... + * * `NR_NODE_ID` - the ID of the node + * * `NR_NODE_NAME` - the Name of the node + * * `NR_NODE_PATH` - the Path of the node + * * `NR_GROUP_ID` - the ID of the containing group + * * `NR_GROUP_NAME` - the Name of the containing group + * * `NR_FLOW_ID` - the ID of the flow the node is on + * * `NR_FLOW_NAME` - the Name of the flow the node is on + * @param name Name of the environment variable to get + * @example + * ```const flowName = env.get("NR_FLOW_NAME");``` + */ + static get(name:string) :string; }