Repository: godotengine/godot
File: editor/editor_log.cpp (C++)

Code before:

	collapse = config->get_value(section, "collapse", false);
	collapse_button->set_pressed(collapse);
	bool show_search = config->get_value(section, "show_search", true);
	search_box->set_visible(show_search);
	show_search_button->set_pressed(show_search);

	is_loading_state = false;
}

void EditorLog::_meta_clicked(const String &p_meta) {
	Ref<RegExMatch> uri_match = RegEx(R"(^([a-zA-Z][a-zA-Z0-9+.-]*):(?://)?(.+?)(?::([0-9]+))?$)").search(p_meta);
	if (uri_match.is_null()) {
		return;
	}

	String scheme = uri_match->get_string(1);
	if (scheme == "res") {
		String file = uri_match->get_string(2);
		int line = (int)uri_match->get_string(3).to_int();
		if (ResourceLoader::exists(file)) {
			Ref<Resource> res = ResourceLoader::load(file);
			ScriptEditor::get_singleton()->edit(res, line - 1, 0);
			InspectorDock::get_singleton()->edit_resource(res);
		}
	} else if (p_meta.contains(".cpp") || p_meta.contains(".h")) {
		// Godot source file. Try to open it in external editor.
		int colon = p_meta.rfind_char(':');
		String path = p_meta.substr(0, colon);
		int line = p_meta.substr(colon + 1).to_int() - 1;

		if (path.begins_with("./") || path.begins_with(".\\")) {
			// Relative path. Convert to absolute, using executable path as reference.
			path = path.trim_prefix("./").trim_prefix(".\\");
			path = OS::get_singleton()->get_executable_path().get_base_dir().get_base_dir().path_join(path);
		}

		if (!ScriptEditorPlugin::open_in_external_editor(path, line, -1, true)) {
			OS::get_singleton()->shell_open(path);
		}
	} else {
		OS::get_singleton()->shell_open(p_meta);
	}
}

void EditorLog::_clear_request() {
	log->clear();
	messages.clear();
	_reset_message_counts();
	tool_button->set_button_icon(Ref<Texture2D>());
}

Review comment (suggestion):
Add support for macOS/iOS platform files:

```suggestion
	} else if (p_meta.contains(".cpp") || p_meta.contains(".h") || p_meta.contains(".mm")) {
```

You could also add `.hpp` but it's not used in any first-party Godot source file, only third-party files and godot-cpp.

Code after:

	collapse = config->get_value(section, "collapse", false);
	collapse_button->set_pressed(collapse);
	bool show_search = config->get_value(section, "show_search", true);
	search_box->set_visible(show_search);
	show_search_button->set_pressed(show_search);

	is_loading_state = false;
}

void EditorLog::_meta_clicked(const String &p_meta) {
	if (!p_meta.contains_char(':')) {
		return;
	}
	const PackedStringArray parts = p_meta.rsplit(":", true, 1);
	String path = parts[0];
	const int line = parts[1].to_int() - 1;

	if (path.begins_with("res://")) {
		if (ResourceLoader::exists(path)) {
			const Ref<Resource> res = ResourceLoader::load(path);
			ScriptEditor::get_singleton()->edit(res, line, 0);
			InspectorDock::get_singleton()->edit_resource(res);
		}
	} else if (path.has_extension("cpp") || path.has_extension("h") || path.has_extension("mm") || path.has_extension("hpp")) {
		// Godot source file. Try to open it in external editor.
		if (path.begins_with("./") || path.begins_with(".\\")) {
			// Relative path. Convert to absolute, using executable path as reference.
			path = path.trim_prefix("./").trim_prefix(".\\");
			path = OS::get_singleton()->get_executable_path().get_base_dir().get_base_dir().path_join(path);
		}

		if (!ScriptEditorPlugin::open_in_external_editor(path, line, -1, true)) {
			OS::get_singleton()->shell_open(path);
		}
	} else {
		OS::get_singleton()->shell_open(p_meta);
	}
}

void EditorLog::_clear_request() {
	log->clear();
	messages.clear();
	_reset_message_counts();
	tool_button->set_button_icon(Ref<Texture2D>());
}

void EditorLog::_copy_request() {
	String text = log->get_selected_text();

	if (text.is_empty()) {