diff --git a/frontend/src/Editor/CodeBuilder/utils.js b/frontend/src/Editor/CodeBuilder/utils.js index 42f6653129..755ec1a3ad 100644 --- a/frontend/src/Editor/CodeBuilder/utils.js +++ b/frontend/src/Editor/CodeBuilder/utils.js @@ -104,7 +104,7 @@ export function getSuggestionKeys(refState, refSource) { return suggestionList; } -export function generateHints(word, suggestions, isEnvironmentVariable = false) { +export function generateHints(word, suggestions, isEnvironmentVariable = false, fromRunJs) { if (word === '') { return suggestions; } @@ -114,6 +114,7 @@ export function generateHints(word, suggestions, isEnvironmentVariable = false) if (isEnvironmentVariable) { return hint.startsWith('client') || hint.startsWith('server'); } else { + if (fromRunJs) return hint; return !hint.startsWith('client') && !hint.startsWith('server'); } }); @@ -207,7 +208,8 @@ export function handleChange(editor, onChange, ignoreBraces = false, currentStat const cursor = editor.getCursor(); const currentWord = computeCurrentWord(editor, cursor.ch, ignoreBraces); const isEnvironmentVariable = editor.getValue().startsWith('%%') ?? false; - const hints = currentWord !== '' ? generateHints(currentWord, suggestions, isEnvironmentVariable) : []; + const hints = + currentWord !== '' ? generateHints(currentWord, suggestions, isEnvironmentVariable, editorSource === 'Runjs') : []; const setCursorPosition = () => { const currentValue = editor.getValue(); if (currentValue.slice(-4) === '{{}}' || currentValue.slice(-4) === '%%') { diff --git a/frontend/src/_helpers/utils.js b/frontend/src/_helpers/utils.js index e8c0cc05f1..638132e4eb 100644 --- a/frontend/src/_helpers/utils.js +++ b/frontend/src/_helpers/utils.js @@ -359,6 +359,8 @@ export async function executeMultilineJS( 'axios', 'variables', 'actions', + 'client', + 'server', code ); result = { @@ -371,7 +373,9 @@ export async function executeMultilineJS( currentState.globals, axios, currentState.variables, - actions + actions, + currentState?.client, + currentState?.server ), }; } catch (err) {