Merge pull request #37171 from Chaosus/shader_fix_time

Fix shader TIME auto-completion
This commit is contained in:
Yuri Roubinsky 2020-03-20 09:35:54 +03:00 committed by GitHub
commit b0aecb466d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
}