### Godot version

4.1.1

### System information

windows 11

### Issue description

When registering a type with class_name and using that class name to declare a variable in code only, autocomplete works as expected anywhere in other nodes/scenes. However, if making a custom scene node that extends a script with the class_name, if that custom scene is instantiated in a different scene, even if the type is specified, it only shows the parent node's functions and not any of the extended functionality. I have made a basic project showing the issue

### Steps to reproduce

I have made a very simple project showing the issue. https://github.com/mmmmmmmmmmmmmmmmmmmdonuts/godot_4_autocomplete_issue essentially, the extended Node scene will only show the custom function when both the type is specified as well as the type afterwards following "as" 
e.g. `@onready var my_class_4: MyClass = $MyClass4 as MyClass`

### Minimal reproduction project

https://github.com/mmmmmmmmmmmmmmmmmmmdonuts/godot_4_autocomplete_issue
}
	} else if (p_annotation->name == SNAME("@warning_ignore")) {
		for (int warning_code = 0; warning_code < GDScriptWarning::WARNING_MAX; warning_code++) {
			ScriptLanguage::CodeCompletionOption warning(GDScriptWarning::get_name_from_code((GDScriptWarning::Code)warning_code).to_lower(), ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT);
			warning.insert_text = warning.display.quote(p_quote_style);
			r_result.insert(warning.display, warning);
		}
	} else if (p_annotation->name == SNAME("@rpc")) {
		if (p_argument == 0 || p_argument == 1 || p_argument == 2) {
			static const char *options[7] = { "call_local", "call_remote", "any_peer", "authority", "reliable", "unreliable", "unreliable_ordered" };
			for (int i = 0; i < 7; i++) {
				ScriptLanguage::CodeCompletionOption option(options[i], ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT);
				option.insert_text = option.display.quote(p_quote_style);
				r_result.insert(option.display, option);
			}
		}
	}
}
static void _find_built_in_variants(HashMap<String, ScriptLanguage::CodeCompletionOption> &r_result, bool exclude_nil = false) {
	for (int i = 0; i < Variant::VARIANT_MAX; i++) {
		if (!exclude_nil && Variant::Type(i) == Variant::Type::NIL) {
			ScriptLanguage::CodeCompletionOption option("null", ScriptLanguage::CODE_COMPLETION_KIND_CLASS);
			r_result.insert(option.display, option);
		} else {
			ScriptLanguage::CodeCompletionOption option(Variant::get_type_name(Variant::Type(i)), ScriptLanguage::CODE_COMPLETION_KIND_CLASS);
			r_result.insert(option.display, option);
		}
	}
}
static void _list_available_types(bool p_inherit_only, GDScriptParser::CompletionContext &p_context, HashMap<String, ScriptLanguage::CodeCompletionOption> &r_result) {