diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 52c1213..7653490 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -40,7 +40,7 @@ jobs: - uses: actions/checkout@v4 with: repository: Far-Beyond-Pulsar/Pulsar-Native - ref: 55aa2dba1c3cd5ddc31d7664985670a2414a4eb6 + ref: 6c61db9aacb29efc4a49bc23a7b1622eb6510a61 submodules: recursive path: pulsar diff --git a/Cargo.lock b/Cargo.lock index acc9cc3..be1fa90 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2653,7 +2653,7 @@ dependencies = [ [[package]] name = "gamma" version = "0.2.0" -source = "git+https://github.com/Far-Beyond-Pulsar/Gamma?rev=b4ebf98486fb716d090d35b689a4eb8a0e414cc1#b4ebf98486fb716d090d35b689a4eb8a0e414cc1" +source = "git+https://github.com/Far-Beyond-Pulsar/Gamma?rev=c8c52864aa7b3e129ab8be4b2d2d5e6af03c255b#c8c52864aa7b3e129ab8be4b2d2d5e6af03c255b" dependencies = [ "gamma-core", "gamma-derive", @@ -2662,7 +2662,7 @@ dependencies = [ [[package]] name = "gamma-core" version = "0.2.0" -source = "git+https://github.com/Far-Beyond-Pulsar/Gamma?rev=b4ebf98486fb716d090d35b689a4eb8a0e414cc1#b4ebf98486fb716d090d35b689a4eb8a0e414cc1" +source = "git+https://github.com/Far-Beyond-Pulsar/Gamma?rev=c8c52864aa7b3e129ab8be4b2d2d5e6af03c255b#c8c52864aa7b3e129ab8be4b2d2d5e6af03c255b" dependencies = [ "rustc-hash 2.1.3", ] @@ -2670,7 +2670,7 @@ dependencies = [ [[package]] name = "gamma-derive" version = "0.2.0" -source = "git+https://github.com/Far-Beyond-Pulsar/Gamma?rev=b4ebf98486fb716d090d35b689a4eb8a0e414cc1#b4ebf98486fb716d090d35b689a4eb8a0e414cc1" +source = "git+https://github.com/Far-Beyond-Pulsar/Gamma?rev=c8c52864aa7b3e129ab8be4b2d2d5e6af03c255b#c8c52864aa7b3e129ab8be4b2d2d5e6af03c255b" dependencies = [ "proc-macro2", "quote", @@ -6520,8 +6520,10 @@ name = "plugin_editor_api" version = "0.1.0" dependencies = [ "engine_subsystems", + "gamma", "gpui-ce", "inventory", + "profiling 0.1.0", "pulsar_events", "pulsar_lsp", "pulsar_reflection", @@ -6547,6 +6549,7 @@ dependencies = [ "once_cell", "parking_lot", "plugin_editor_api", + "profiling 0.1.0", "pulsar_events", "pulsar_world_registry", "serde_json", @@ -6989,7 +6992,7 @@ dependencies = [ [[package]] name = "pulsar_scenedb" version = "0.1.0" -source = "git+https://github.com//Far-Beyond-Pulsar/SceneDB?rev=685b1b0aa212b64912549efd583c93480bea027f#685b1b0aa212b64912549efd583c93480bea027f" +source = "git+https://github.com//Far-Beyond-Pulsar/SceneDB?rev=81bb3557b71014ccc00f1275f60138867cc492ea#81bb3557b71014ccc00f1275f60138867cc492ea" dependencies = [ "ahash", "profiling 0.1.0", @@ -7005,7 +7008,7 @@ dependencies = [ [[package]] name = "pulsar_scenedb_derive" version = "0.1.0" -source = "git+https://github.com//Far-Beyond-Pulsar/SceneDB?rev=685b1b0aa212b64912549efd583c93480bea027f#685b1b0aa212b64912549efd583c93480bea027f" +source = "git+https://github.com//Far-Beyond-Pulsar/SceneDB?rev=81bb3557b71014ccc00f1275f60138867cc492ea#81bb3557b71014ccc00f1275f60138867cc492ea" dependencies = [ "proc-macro2", "pulsar_reflection_codegen", diff --git a/Cargo.toml b/Cargo.toml index c865aec..a5593aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -132,8 +132,8 @@ pulsar_reflection_codegen = { path = "../../../crates/external/pulsar-reflection # The patch VALUE uses the `//`-spelled URL: cargo refuses a patch that resolves # to the exact same source, so the alternate spelling carries the pushed rev. [patch."https://github.com/Far-Beyond-Pulsar/SceneDB"] -pulsar_scenedb = { git = "https://github.com//Far-Beyond-Pulsar/SceneDB", rev = "685b1b0aa212b64912549efd583c93480bea027f" } -pulsar_scenedb_derive = { git = "https://github.com//Far-Beyond-Pulsar/SceneDB", rev = "685b1b0aa212b64912549efd583c93480bea027f" } +pulsar_scenedb = { git = "https://github.com//Far-Beyond-Pulsar/SceneDB", rev = "81bb3557b71014ccc00f1275f60138867cc492ea" } +pulsar_scenedb_derive = { git = "https://github.com//Far-Beyond-Pulsar/SceneDB", rev = "81bb3557b71014ccc00f1275f60138867cc492ea" } [profile.dev.package."*"] # Keep our crate fast to compile, but optimize heavy dependencies diff --git a/src/script_editor/mod.rs b/src/script_editor/mod.rs index 3b5464e..6194038 100644 --- a/src/script_editor/mod.rs +++ b/src/script_editor/mod.rs @@ -638,6 +638,7 @@ impl ScriptEditor { let dirty = editor.current_is_modified(); let generating = editor.is_generating(); let status = editor.lsp_status(cx); + let view_focus = editor.current_view().map(|view| view.focus_handle(cx)); h_flex() .w_full() @@ -648,10 +649,16 @@ impl ScriptEditor { .border_b_1() .border_color(cx.theme().border) .child( - div() - .text_sm() - .text_color(cx.theme().muted_foreground) - .child(path), + h_flex() + .gap_2() + .items_center() + .child(Self::render_menus(view_focus)) + .child( + div() + .text_sm() + .text_color(cx.theme().muted_foreground) + .child(path), + ), ) .child( div() @@ -690,6 +697,44 @@ impl ScriptEditor { ) } + /// The editor's menu strip (Pulsar-Native#1012). Its items dispatch to + /// the open file's view, whose panel handles them as it does for the + /// context menu and the keys. + fn render_menus(view_focus: Option) -> impl IntoElement { + use text_editor::{ + EditorCopy, EditorCopyPath, EditorCut, EditorPaste, EditorRedo, EditorSave, + EditorSelectAll, EditorUndo, EditorUnfoldAll, + }; + let open = view_focus.is_some(); + let strip = plugin_editor_api::EditorMenuStrip::new("script-editor-menus") + .menu( + plugin_editor_api::EditorMenu::new("File") + .action_if("Save", EditorSave, open) + .action_if("Copy File Path", EditorCopyPath, open), + ) + .menu( + plugin_editor_api::EditorMenu::new("Edit") + .action_if("Undo", EditorUndo, open) + .action_if("Redo", EditorRedo, open) + .separator() + .action_if("Cut", EditorCut, open) + .action_if("Copy", EditorCopy, open) + .action_if("Paste", EditorPaste, open), + ) + .menu( + plugin_editor_api::EditorMenu::new("Selection") + .action_if("Select All", EditorSelectAll, open), + ) + .menu( + plugin_editor_api::EditorMenu::new("View") + .action_if("Unfold All", EditorUnfoldAll, open), + ); + match view_focus { + Some(focus) => strip.action_context(focus), + None => strip, + } + } + /// Synchronize scroll positions between left and right editors in diff mode fn sync_diff_editor_scrolls(&mut self, cx: &mut Context) { if self.mode != ScriptEditorMode::Diff {