1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Autocompletion: Override context for preload

This commit is contained in:
HolonProduction
2025-02-13 22:49:03 +01:00
parent 1a0bf54677
commit c00518eec7
2 changed files with 3 additions and 2 deletions

View File

@@ -878,8 +878,7 @@ static void _get_directory_contents(EditorFileSystemDirectory *p_dir, HashMap<St
if (requires_type && !ClassDB::is_parent_class(p_dir->get_file_type(i), p_required_type)) { if (requires_type && !ClassDB::is_parent_class(p_dir->get_file_type(i), p_required_type)) {
continue; continue;
} }
ScriptLanguage::CodeCompletionOption option(p_dir->get_file_path(i), ScriptLanguage::CODE_COMPLETION_KIND_FILE_PATH); ScriptLanguage::CodeCompletionOption option(p_dir->get_file_path(i).quote(quote_style), ScriptLanguage::CODE_COMPLETION_KIND_FILE_PATH);
option.insert_text = option.display.quote(quote_style);
r_list.insert(option.display, option); r_list.insert(option.display, option);
} }

View File

@@ -3487,6 +3487,8 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_preload(ExpressionNode *p_
if (preload->path == nullptr) { if (preload->path == nullptr) {
push_error(R"(Expected resource path after "(".)"); push_error(R"(Expected resource path after "(".)");
} else if (preload->path->type == Node::LITERAL) {
override_completion_context(preload->path, COMPLETION_RESOURCE_PATH, preload);
} }
pop_completion_call(); pop_completion_call();