diff --git a/crates/editor2/src/display_map/block_map.rs b/crates/editor2/src/display_map/block_map.rs
index 64e46549fd6c7b9ae2576ca68d7c0f2af52b750e..cc0095bca94f30f6d65866c640092cb384d2cce3 100644
--- a/crates/editor2/src/display_map/block_map.rs
+++ b/crates/editor2/src/display_map/block_map.rs
@@ -993,7 +993,7 @@ mod tests {
use super::*;
use crate::display_map::inlay_map::InlayMap;
use crate::display_map::{fold_map::FoldMap, tab_map::TabMap, wrap_map::WrapMap};
- use gpui::{div, font, px, Element, Platform as _};
+ use gpui::{div, font, px, Element};
use multi_buffer::MultiBuffer;
use rand::prelude::*;
use settings::SettingsStore;
@@ -1185,11 +1185,7 @@ mod tests {
fn test_blocks_on_wrapped_lines(cx: &mut gpui::TestAppContext) {
cx.update(|cx| init_test(cx));
- let font_id = cx
- .test_platform
- .text_system()
- .font_id(&font("Helvetica"))
- .unwrap();
+ let font_id = cx.text_system().font_id(&font("Helvetica")).unwrap();
let text = "one two three\nfour five six\nseven eight";
diff --git a/crates/editor2/src/display_map/wrap_map.rs b/crates/editor2/src/display_map/wrap_map.rs
index a2ac0ec849bfb9b26983c897a2ae3cc2ebd9878c..ca9db7754baec0b1477c19d0f8efaa98fd8f14c3 100644
--- a/crates/editor2/src/display_map/wrap_map.rs
+++ b/crates/editor2/src/display_map/wrap_map.rs
@@ -1032,7 +1032,7 @@ mod tests {
display_map::{fold_map::FoldMap, inlay_map::InlayMap, tab_map::TabMap},
MultiBuffer,
};
- use gpui::{font, px, test::observe, Platform};
+ use gpui::{font, px, test::observe};
use rand::prelude::*;
use settings::SettingsStore;
use smol::stream::StreamExt;
diff --git a/crates/editor2/src/editor_tests.rs b/crates/editor2/src/editor_tests.rs
index 424da8987eb6d673f0e789d4b8ae8b1620967045..b5f156f494936cba312d9b44365d1a903a803c4e 100644
--- a/crates/editor2/src/editor_tests.rs
+++ b/crates/editor2/src/editor_tests.rs
@@ -12,7 +12,7 @@ use futures::StreamExt;
use gpui::{
div,
serde_json::{self, json},
- Div, Flatten, Platform, TestAppContext, VisualTestContext, WindowBounds, WindowOptions,
+ Div, Flatten, TestAppContext, VisualTestContext, WindowBounds, WindowOptions,
};
use indoc::indoc;
use language::{
@@ -3238,9 +3238,7 @@ async fn test_clipboard(cx: &mut gpui::TestAppContext) {
the lazy dog"});
cx.update_editor(|e, cx| e.copy(&Copy, cx));
assert_eq!(
- cx.test_platform
- .read_from_clipboard()
- .map(|item| item.text().to_owned()),
+ cx.read_from_clipboard().map(|item| item.text().to_owned()),
Some("fox jumps over\n".to_owned())
);
diff --git a/crates/gpui2/src/app.rs b/crates/gpui2/src/app.rs
index 74712feb287468ef67917235b544ffd85ecf8400..79beca75da7f89e83ff2dcd9079f45c29ff153e2 100644
--- a/crates/gpui2/src/app.rs
+++ b/crates/gpui2/src/app.rs
@@ -15,10 +15,10 @@ use smol::future::FutureExt;
pub use test_context::*;
use crate::{
- current_platform, image_cache::ImageCache, Action, ActionRegistry, Any, AnyView,
- AnyWindowHandle, AppMetadata, AssetSource, BackgroundExecutor, ClipboardItem, Context,
+ current_platform, image_cache::ImageCache, init_app_menus, Action, ActionRegistry, Any,
+ AnyView, AnyWindowHandle, AppMetadata, AssetSource, BackgroundExecutor, ClipboardItem, Context,
DispatchPhase, DisplayId, Entity, EventEmitter, FocusEvent, FocusHandle, FocusId,
- ForegroundExecutor, KeyBinding, Keymap, LayoutId, PathPromptOptions, Pixels, Platform,
+ ForegroundExecutor, KeyBinding, Keymap, LayoutId, Menu, PathPromptOptions, Pixels, Platform,
PlatformDisplay, Point, Render, SharedString, SubscriberSet, Subscription, SvgRenderer, Task,
TextStyle, TextStyleRefinement, TextSystem, View, ViewContext, Window, WindowContext,
WindowHandle, WindowId,
@@ -278,6 +278,8 @@ impl AppContext {
}),
});
+ init_app_menus(platform.as_ref(), &mut *app.borrow_mut());
+
platform.on_quit(Box::new({
let cx = app.clone();
move || {
@@ -1059,6 +1061,19 @@ impl AppContext {
.contains_key(&action.as_any().type_id())
}
+ pub fn set_menus(&mut self, menus: Vec