Skip to content

Commit c00518e

Browse files
Autocompletion: Override context for preload
1 parent 1a0bf54 commit c00518e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

modules/gdscript/gdscript_editor.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -878,8 +878,7 @@ static void _get_directory_contents(EditorFileSystemDirectory *p_dir, HashMap<St
878878
if (requires_type && !ClassDB::is_parent_class(p_dir->get_file_type(i), p_required_type)) {
879879
continue;
880880
}
881-
ScriptLanguage::CodeCompletionOption option(p_dir->get_file_path(i), ScriptLanguage::CODE_COMPLETION_KIND_FILE_PATH);
882-
option.insert_text = option.display.quote(quote_style);
881+
ScriptLanguage::CodeCompletionOption option(p_dir->get_file_path(i).quote(quote_style), ScriptLanguage::CODE_COMPLETION_KIND_FILE_PATH);
883882
r_list.insert(option.display, option);
884883
}
885884

modules/gdscript/gdscript_parser.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -3487,6 +3487,8 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_preload(ExpressionNode *p_
34873487

34883488
if (preload->path == nullptr) {
34893489
push_error(R"(Expected resource path after "(".)");
3490+
} else if (preload->path->type == Node::LITERAL) {
3491+
override_completion_context(preload->path, COMPLETION_RESOURCE_PATH, preload);
34903492
}
34913493

34923494
pop_completion_call();

0 commit comments

Comments
 (0)