Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- uses: actions/checkout@v4
with:
repository: Far-Beyond-Pulsar/Pulsar-Native
ref: 55aa2dba1c3cd5ddc31d7664985670a2414a4eb6
ref: 6c61db9aacb29efc4a49bc23a7b1622eb6510a61
submodules: recursive
path: pulsar

Expand Down
13 changes: 8 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
53 changes: 49 additions & 4 deletions src/script_editor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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<FocusHandle>) -> 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<Self>) {
if self.mode != ScriptEditorMode::Diff {
Expand Down
Loading