From 7afbd5904e8cfccd8e87ddfca9f05359ca2df113 Mon Sep 17 00:00:00 2001 From: ray90514 Date: Fri, 9 Apr 2021 23:02:39 +0800 Subject: [PATCH] Fix Script editor completion doesn't suggest members of a script for type hints --- modules/gdscript/gdscript_editor.cpp | 11 ++++++++++- modules/gdscript/gdscript_parser.cpp | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index d1b49076abd..89eadd9ca6f 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -2983,8 +2983,17 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path base_type.has_type = false; } } break; - case GDScriptParser::DataType::SCRIPT: case GDScriptParser::DataType::GDSCRIPT: { + Ref scr = base_type.script_type; + if (scr.is_valid()) { + for (const Map>::Element *E = scr->get_subclasses().front(); E; E = E->next()) { + ScriptCodeCompletionOption option(E->key().operator String(), ScriptCodeCompletionOption::KIND_CLASS); + options.insert(option.display, option); + } + } + FALLTHROUGH; + } + case GDScriptParser::DataType::SCRIPT: { Ref