Remove incorrect items from completion of main functions in shader

This commit is contained in:
Yuri Roubinsky 2022-01-24 10:01:24 +03:00
parent 31a7ddbf83
commit 0e66587dbf
1 changed files with 13 additions and 0 deletions

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);
}