Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Script editor completion doesn't suggest members of a script for type hints #48037

Merged
merged 1 commit into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion modules/gdscript/gdscript_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<GDScript> scr = base_type.script_type;
if (scr.is_valid()) {
for (const Map<StringName, Ref<GDScript>>::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;
}
akien-mga marked this conversation as resolved.
Show resolved Hide resolved
case GDScriptParser::DataType::SCRIPT: {
Ref<Script> scr = base_type.script_type;
if (scr.is_valid()) {
Map<StringName, Variant> constants;
Expand Down
1 change: 1 addition & 0 deletions modules/gdscript/gdscript_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5786,6 +5786,7 @@ bool GDScriptParser::_parse_type(DataType &r_type, bool p_can_be_void) {
can_index = false;
tokenizer->advance();
} break;
case GDScriptTokenizer::TK_CURSOR:
case GDScriptTokenizer::TK_IDENTIFIER: {
if (can_index) {
_set_error("Unexpected identifier.");
Expand Down