Visual Studio Code, rebuilt in Rust
Rust
fix(welcome): open the welcome page out of the modal editor
rokarturfa8950de8375
diff --git a/native/crates/app/src/workbench/modal_editor_group/tests.rs b/native/crates/app/src/workbench/modal_editor_group/tests.rsindex 7a75e831bc7..714c1398db2 100644--- a/native/crates/app/src/workbench/modal_editor_group/tests.rs+++ b/native/crates/app/src/workbench/modal_editor_group/tests.rs@@ -401,3 +401,20 @@ fn use_modal_all_reveals_an_opened_editor_in_its_group_unless_an_index_is_given(});std::fs::remove_dir_all(dir).unwrap();}++/// editorGroupFinder.ts `handleModalEditorPart`: the Welcome page opened over the Workspace Trust editor closes the+/// modal and opens in the main part, without breadcrumbs (its `walkThrough` resource has no file system provider).+#[gpui::test]+fn the_welcome_page_opened_over_a_modal_opens_in_the_main_part(cx: &mut TestAppContext) {+ let (workbench, cx, dir) = preferences_window(cx, "welcome-over-modal");+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.trust.manage", vec![], window, cx)));+ cx.run_until_parked();+ workbench.read_with(cx, |workbench, _| assert_eq!(workbench.editors.id, MODAL_GROUP));+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.action.openWalkthrough", vec![], window, cx)));+ cx.run_until_parked();+ workbench.read_with(cx, |workbench, _| {+ assert!(!workbench.modal_group_open());+ assert_eq!(workbench.editors.active().unwrap().document().scheme, crate::workbench::welcome_page::WALKTHROUGH_SCHEME);+ });+ std::fs::remove_dir_all(dir).unwrap();+}diff --git a/native/crates/app/src/workbench/welcome_page.rs b/native/crates/app/src/workbench/welcome_page.rsindex 10ec02737ec..d04fbdf3e3e 100644--- a/native/crates/app/src/workbench/welcome_page.rs+++ b/native/crates/app/src/workbench/welcome_page.rs@@ -433,6 +433,10 @@ impl Workbench {fn open_welcome_page(&mut self, preview: bool, window: &mut Window, cx: &mut Context<Self>) {self.ensure_walkthroughs(window);let path = PathBuf::from(GETTING_STARTED_PATH);+ // editorGroupFinder.ts `handleModalEditorPart`: the page opens in the main part and closes the modal.+ if self.setting("workbench.editor.useModal") != json!("all") {+ self.close_modal_editor(window, cx);+ }self.leave_locked_group(WALKTHROUGH_SCHEME, &path);match self.editors.editors.iter().position(|editor| editor.document().is(WALKTHROUGH_SCHEME, &path)) {Some(index) => self.editors.activate(index),