MCPcopy Create free account
hub / github.com/PerroEngine/Perro / open_active_file

Function open_active_file

perro_editor/res/scripts/scene/editor_nav.rs:1180–1197  ·  view source on GitHub ↗
(ctx: &mut ScriptContext<'_, API>)

Source from the content-addressed store, hash-verified

1178 Some("open") => open_active_file(ctx),
1179 Some("refresh") => refresh_all(ctx),
1180 _ => {}
1181 }
1182}
1183
1184pub fn open_active_file<API: ScriptAPI + ?Sized>(ctx: &mut ScriptContext<'_, API>) {
1185 let idx = with_state!(ctx.run, EditorState, ctx.id, |state| {
1186 if state.sidebar_mode != "files" {
1187 return None;
1188 }
1189 let paths = filtered_file_paths(state);
1190 if paths.is_empty() {
1191 return None;
1192 }
1193 paths
1194 .iter()
1195 .position(|path| path == &state.active_asset_path)
1196 .or(Some(0))
1197 }).unwrap_or_default();
1198 if let Some(idx) = idx {
1199 open_file_slot(ctx, idx);
1200 }

Callers 3

update_editor_shortcutsFunction · 0.85
expand_selected_fileFunction · 0.85
open_sidebar_selectionFunction · 0.85

Calls 1

open_file_slotFunction · 0.85

Tested by

no test coverage detected