summaryrefslogtreecommitdiff
path: root/servers/rendering
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2022-01-24 10:01:24 +0300
committerYuri Roubinsky <chaosus89@gmail.com>2022-01-24 10:37:47 +0300
commit0e66587dbf0210948e270b9e2fea7b0b6fabc499 (patch)
tree6da58ae570d5ba4690383741635367be885ccc4c /servers/rendering
parent31a7ddbf838572e50415159a56720275f9523262 (diff)
Remove incorrect items from completion of main functions in shader
Diffstat (limited to 'servers/rendering')
-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);
}