Fix shader TIME auto-completion

This commit is contained in:
Yuri Roubinsky 2020-03-19 21:26:35 +03:00
parent 1a532d53cc
commit 523dae6bba
1 changed files with 20 additions and 11 deletions

View File

@ -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)) {
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);
}
}
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);
}
}
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);
}
}
for (const Map<StringName, ShaderNode::Varying>::Element *E = shader->varyings.front(); E; E = E->next()) {
matches.insert(E->key(), ScriptCodeCompletionOption::KIND_VARIABLE);
}