diff options
-rw-r--r-- | servers/visual/shader_language.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 713b54e1ba..084ade8855 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -6722,18 +6722,27 @@ Error ShaderLanguage::complete(const String &p_code, const Map<StringName, Funct block = block->parent_block; } - if (comp_ident && skip_function != StringName() && p_functions.has(skip_function)) { + if (comp_ident) { + if (p_functions.has("global")) { + for (Map<StringName, BuiltInInfo>::Element *E = p_functions["global"].built_ins.front(); E; E = E->next()) { + ScriptCodeCompletionOption::Kind kind = ScriptCodeCompletionOption::KIND_MEMBER; + if (E->get().constant) { + kind = ScriptCodeCompletionOption::KIND_CONSTANT; + } + matches.insert(E->key(), kind); + } + } - for (Map<StringName, BuiltInInfo>::Element *E = p_functions[skip_function].built_ins.front(); E; E = E->next()) { - ScriptCodeCompletionOption::Kind kind = ScriptCodeCompletionOption::KIND_MEMBER; - if (E->get().constant) { - kind = ScriptCodeCompletionOption::KIND_CONSTANT; + if (skip_function != StringName() && p_functions.has(skip_function)) { + for (Map<StringName, BuiltInInfo>::Element *E = p_functions[skip_function].built_ins.front(); E; E = E->next()) { + ScriptCodeCompletionOption::Kind kind = ScriptCodeCompletionOption::KIND_MEMBER; + if (E->get().constant) { + kind = ScriptCodeCompletionOption::KIND_CONSTANT; + } + matches.insert(E->key(), kind); } - matches.insert(E->key(), kind); } - } - if (comp_ident) { for (const Map<StringName, ShaderNode::Varying>::Element *E = shader->varyings.front(); E; E = E->next()) { matches.insert(E->key(), ScriptCodeCompletionOption::KIND_VARIABLE); } |