Fixed the issue (#4790)

This commit is contained in:
Muhsin Shah C P 2022-12-22 17:16:50 +05:30 committed by GitHub
parent 60bc09f0ba
commit c5d74c4a27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View file

@ -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) === '%%') {

View file

@ -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) {