Merge pull request #57107 from Chaosus/shader_fix_completion

This commit is contained in:
Yuri Roubinsky 2022-01-24 11:53:11 +03:00 committed by GitHub
commit 0d4b86a30c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9060,6 +9060,19 @@ Error ShaderLanguage::complete(const String &p_code, const ShaderCompileInfo &p_
} break;
case COMPLETION_MAIN_FUNCTION: {
for (const KeyValue<StringName, FunctionInfo> &E : p_info.functions) {
if (!E.value.main_function) {
continue;
}
bool found = false;
for (int i = 0; i < shader->functions.size(); i++) {
if (shader->functions[i].name == E.key) {
found = true;
break;
}
}
if (found) {
continue;
}
ScriptCodeCompletionOption option(E.key, ScriptCodeCompletionOption::KIND_FUNCTION);
r_options->push_back(option);
}