summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2022-01-24 11:53:11 +0300
committerGitHub <noreply@github.com>2022-01-24 11:53:11 +0300
commit0d4b86a30c3f521210da8508440e0c40de11a22f (patch)
tree70e08f6573330b8f77a7cdc2e6437b3fdfb52995
parent06abfd8c130a90130eb468d2132321b3c0ccba9b (diff)
parent0e66587dbf0210948e270b9e2fea7b0b6fabc499 (diff)
Merge pull request #57107 from Chaosus/shader_fix_completion
-rw-r--r--servers/rendering/shader_language.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index cb1329d33c..f16f66544a 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -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);
}