1mod remote_projects;
2
3use feature_flags::FeatureFlagAppExt;
4use fuzzy::{StringMatch, StringMatchCandidate};
5use gpui::{
6 Action, AnyElement, AppContext, DismissEvent, EventEmitter, FocusHandle, FocusableView,
7 Subscription, Task, View, ViewContext, WeakView,
8};
9use ordered_float::OrderedFloat;
10use picker::{
11 highlighted_match_with_paths::{HighlightedMatchWithPaths, HighlightedText},
12 Picker, PickerDelegate,
13};
14use remote_projects::RemoteProjects;
15use rpc::proto::DevServerStatus;
16use serde::Deserialize;
17use std::{
18 path::{Path, PathBuf},
19 sync::Arc,
20};
21use ui::{
22 prelude::*, tooltip_container, ButtonLike, IconWithIndicator, Indicator, KeyBinding, ListItem,
23 ListItemSpacing, Tooltip,
24};
25use util::{paths::PathExt, ResultExt};
26use workspace::{
27 AppState, ModalView, SerializedWorkspaceLocation, Workspace, WorkspaceId, WORKSPACE_DB,
28};
29
30#[derive(PartialEq, Clone, Deserialize, Default)]
31pub struct OpenRecent {
32 #[serde(default = "default_create_new_window")]
33 pub create_new_window: bool,
34}
35
36fn default_create_new_window() -> bool {
37 true
38}
39
40gpui::impl_actions!(projects, [OpenRecent]);
41gpui::actions!(projects, [OpenRemote]);
42
43pub fn init(cx: &mut AppContext) {
44 cx.observe_new_views(RecentProjects::register).detach();
45 cx.observe_new_views(remote_projects::RemoteProjects::register)
46 .detach();
47}
48
49pub struct RecentProjects {
50 pub picker: View<Picker<RecentProjectsDelegate>>,
51 rem_width: f32,
52 _subscription: Subscription,
53}
54
55impl ModalView for RecentProjects {}
56
57impl RecentProjects {
58 fn new(delegate: RecentProjectsDelegate, rem_width: f32, cx: &mut ViewContext<Self>) -> Self {
59 let picker = cx.new_view(|cx| {
60 // We want to use a list when we render paths, because the items can have different heights (multiple paths).
61 if delegate.render_paths {
62 Picker::list(delegate, cx)
63 } else {
64 Picker::uniform_list(delegate, cx)
65 }
66 });
67 let _subscription = cx.subscribe(&picker, |_, _, _, cx| cx.emit(DismissEvent));
68 // We do not want to block the UI on a potentially lengthy call to DB, so we're gonna swap
69 // out workspace locations once the future runs to completion.
70 cx.spawn(|this, mut cx| async move {
71 let workspaces = WORKSPACE_DB
72 .recent_workspaces_on_disk()
73 .await
74 .log_err()
75 .unwrap_or_default();
76 this.update(&mut cx, move |this, cx| {
77 this.picker.update(cx, move |picker, cx| {
78 picker.delegate.set_workspaces(workspaces);
79 picker.update_matches(picker.query(cx), cx)
80 })
81 })
82 .ok()
83 })
84 .detach();
85 Self {
86 picker,
87 rem_width,
88 _subscription,
89 }
90 }
91
92 fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
93 workspace.register_action(|workspace, open_recent: &OpenRecent, cx| {
94 let Some(recent_projects) = workspace.active_modal::<Self>(cx) else {
95 Self::open(workspace, open_recent.create_new_window, cx);
96 return;
97 };
98
99 recent_projects.update(cx, |recent_projects, cx| {
100 recent_projects
101 .picker
102 .update(cx, |picker, cx| picker.cycle_selection(cx))
103 });
104 });
105 }
106
107 pub fn open(
108 workspace: &mut Workspace,
109 create_new_window: bool,
110 cx: &mut ViewContext<Workspace>,
111 ) {
112 let weak = cx.view().downgrade();
113 workspace.toggle_modal(cx, |cx| {
114 let delegate = RecentProjectsDelegate::new(weak, create_new_window, true);
115 let modal = Self::new(delegate, 34., cx);
116 modal
117 })
118 }
119
120 pub fn open_popover(workspace: WeakView<Workspace>, cx: &mut WindowContext<'_>) -> View<Self> {
121 cx.new_view(|cx| {
122 Self::new(
123 RecentProjectsDelegate::new(workspace, false, false),
124 20.,
125 cx,
126 )
127 })
128 }
129}
130
131impl EventEmitter<DismissEvent> for RecentProjects {}
132
133impl FocusableView for RecentProjects {
134 fn focus_handle(&self, cx: &AppContext) -> FocusHandle {
135 self.picker.focus_handle(cx)
136 }
137}
138
139impl Render for RecentProjects {
140 fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
141 v_flex()
142 .w(rems(self.rem_width))
143 .child(self.picker.clone())
144 .on_mouse_down_out(cx.listener(|this, _, cx| {
145 this.picker.update(cx, |this, cx| {
146 this.cancel(&Default::default(), cx);
147 })
148 }))
149 }
150}
151
152pub struct RecentProjectsDelegate {
153 workspace: WeakView<Workspace>,
154 workspaces: Vec<(WorkspaceId, SerializedWorkspaceLocation)>,
155 selected_match_index: usize,
156 matches: Vec<StringMatch>,
157 render_paths: bool,
158 create_new_window: bool,
159 // Flag to reset index when there is a new query vs not reset index when user delete an item
160 reset_selected_match_index: bool,
161 has_any_remote_projects: bool,
162}
163
164impl RecentProjectsDelegate {
165 fn new(workspace: WeakView<Workspace>, create_new_window: bool, render_paths: bool) -> Self {
166 Self {
167 workspace,
168 workspaces: Vec::new(),
169 selected_match_index: 0,
170 matches: Default::default(),
171 create_new_window,
172 render_paths,
173 reset_selected_match_index: true,
174 has_any_remote_projects: false,
175 }
176 }
177
178 pub fn set_workspaces(&mut self, workspaces: Vec<(WorkspaceId, SerializedWorkspaceLocation)>) {
179 self.workspaces = workspaces;
180 self.has_any_remote_projects = self
181 .workspaces
182 .iter()
183 .any(|(_, location)| matches!(location, SerializedWorkspaceLocation::Remote(_)));
184 }
185}
186impl EventEmitter<DismissEvent> for RecentProjectsDelegate {}
187impl PickerDelegate for RecentProjectsDelegate {
188 type ListItem = ListItem;
189
190 fn placeholder_text(&self, cx: &mut WindowContext) -> Arc<str> {
191 let (create_window, reuse_window) = if self.create_new_window {
192 (
193 cx.keystroke_text_for(&menu::Confirm),
194 cx.keystroke_text_for(&menu::SecondaryConfirm),
195 )
196 } else {
197 (
198 cx.keystroke_text_for(&menu::SecondaryConfirm),
199 cx.keystroke_text_for(&menu::Confirm),
200 )
201 };
202 Arc::from(format!(
203 "{reuse_window} reuses this window, {create_window} opens a new one",
204 ))
205 }
206
207 fn match_count(&self) -> usize {
208 self.matches.len()
209 }
210
211 fn selected_index(&self) -> usize {
212 self.selected_match_index
213 }
214
215 fn set_selected_index(&mut self, ix: usize, _cx: &mut ViewContext<Picker<Self>>) {
216 self.selected_match_index = ix;
217 }
218
219 fn update_matches(
220 &mut self,
221 query: String,
222 cx: &mut ViewContext<Picker<Self>>,
223 ) -> gpui::Task<()> {
224 let query = query.trim_start();
225 let smart_case = query.chars().any(|c| c.is_uppercase());
226 let candidates = self
227 .workspaces
228 .iter()
229 .enumerate()
230 .map(|(id, (_, location))| {
231 let combined_string = match location {
232 SerializedWorkspaceLocation::Local(paths) => paths
233 .paths()
234 .iter()
235 .map(|path| path.compact().to_string_lossy().into_owned())
236 .collect::<Vec<_>>()
237 .join(""),
238 SerializedWorkspaceLocation::Remote(remote_project) => {
239 format!("{}{}", remote_project.dev_server_name, remote_project.path)
240 }
241 };
242
243 StringMatchCandidate::new(id, combined_string)
244 })
245 .collect::<Vec<_>>();
246 self.matches = smol::block_on(fuzzy::match_strings(
247 candidates.as_slice(),
248 query,
249 smart_case,
250 100,
251 &Default::default(),
252 cx.background_executor().clone(),
253 ));
254 self.matches.sort_unstable_by_key(|m| m.candidate_id);
255
256 if self.reset_selected_match_index {
257 self.selected_match_index = self
258 .matches
259 .iter()
260 .enumerate()
261 .rev()
262 .max_by_key(|(_, m)| OrderedFloat(m.score))
263 .map(|(ix, _)| ix)
264 .unwrap_or(0);
265 }
266 self.reset_selected_match_index = true;
267 Task::ready(())
268 }
269
270 fn confirm(&mut self, secondary: bool, cx: &mut ViewContext<Picker<Self>>) {
271 if let Some((selected_match, workspace)) = self
272 .matches
273 .get(self.selected_index())
274 .zip(self.workspace.upgrade())
275 {
276 let (candidate_workspace_id, candidate_workspace_location) =
277 &self.workspaces[selected_match.candidate_id];
278 let replace_current_window = if self.create_new_window {
279 secondary
280 } else {
281 !secondary
282 };
283 workspace
284 .update(cx, |workspace, cx| {
285 if workspace.database_id() == *candidate_workspace_id {
286 Task::ready(Ok(()))
287 } else {
288 match candidate_workspace_location {
289 SerializedWorkspaceLocation::Local(paths) => {
290 let paths = paths.paths().as_ref().clone();
291 if replace_current_window {
292 cx.spawn(move |workspace, mut cx| async move {
293 let continue_replacing = workspace
294 .update(&mut cx, |workspace, cx| {
295 workspace.prepare_to_close(true, cx)
296 })?
297 .await?;
298 if continue_replacing {
299 workspace
300 .update(&mut cx, |workspace, cx| {
301 workspace
302 .open_workspace_for_paths(true, paths, cx)
303 })?
304 .await
305 } else {
306 Ok(())
307 }
308 })
309 } else {
310 workspace.open_workspace_for_paths(false, paths, cx)
311 }
312 }
313 //TODO support opening remote projects in the same window
314 SerializedWorkspaceLocation::Remote(remote_project) => {
315 let store = ::remote_projects::Store::global(cx).read(cx);
316 let Some(project_id) = store
317 .remote_project(remote_project.id)
318 .and_then(|p| p.project_id)
319 else {
320 let dev_server_name = remote_project.dev_server_name.clone();
321 return cx.spawn(|workspace, mut cx| async move {
322 let response =
323 cx.prompt(gpui::PromptLevel::Warning,
324 "Dev Server is offline",
325 Some(format!("Cannot connect to {}. To debug open the remote project settings.", dev_server_name).as_str()),
326 &["Ok", "Open Settings"]
327 ).await?;
328 if response == 1 {
329 workspace.update(&mut cx, |workspace, cx| {
330 workspace.toggle_modal(cx, |cx| RemoteProjects::new(cx))
331 })?;
332 } else {
333 workspace.update(&mut cx, |workspace, cx| {
334 RecentProjects::open(workspace, true, cx);
335 })?;
336 }
337 Ok(())
338 })
339 };
340 if let Some(app_state) = AppState::global(cx).upgrade() {
341 let task =
342 workspace::join_remote_project(project_id, app_state, cx);
343 cx.spawn(|_, _| async move {
344 task.await?;
345 Ok(())
346 })
347 } else {
348 Task::ready(Err(anyhow::anyhow!("App state not found")))
349 }
350 }
351 }
352 }
353 })
354 .detach_and_log_err(cx);
355 cx.emit(DismissEvent);
356 }
357 }
358
359 fn dismissed(&mut self, _: &mut ViewContext<Picker<Self>>) {}
360
361 fn no_matches_text(&self, _cx: &mut WindowContext) -> SharedString {
362 if self.workspaces.is_empty() {
363 "Recently opened projects will show up here".into()
364 } else {
365 "No matches".into()
366 }
367 }
368
369 fn render_match(
370 &self,
371 ix: usize,
372 selected: bool,
373 cx: &mut ViewContext<Picker<Self>>,
374 ) -> Option<Self::ListItem> {
375 let Some(hit) = self.matches.get(ix) else {
376 return None;
377 };
378
379 let (workspace_id, location) = &self.workspaces[hit.candidate_id];
380 let is_current_workspace = self.is_current_workspace(*workspace_id, cx);
381
382 let is_remote = matches!(location, SerializedWorkspaceLocation::Remote(_));
383 let dev_server_status =
384 if let SerializedWorkspaceLocation::Remote(remote_project) = location {
385 let store = ::remote_projects::Store::global(cx).read(cx);
386 Some(
387 store
388 .remote_project(remote_project.id)
389 .and_then(|p| store.dev_server(p.dev_server_id))
390 .map(|s| s.status)
391 .unwrap_or_default(),
392 )
393 } else {
394 None
395 };
396
397 let mut path_start_offset = 0;
398 let paths = match location {
399 SerializedWorkspaceLocation::Local(paths) => paths.paths(),
400 SerializedWorkspaceLocation::Remote(remote_project) => Arc::new(vec![PathBuf::from(
401 format!("{}:{}", remote_project.dev_server_name, remote_project.path),
402 )]),
403 };
404
405 let (match_labels, paths): (Vec<_>, Vec<_>) = paths
406 .iter()
407 .map(|path| {
408 let path = path.compact();
409 let highlighted_text =
410 highlights_for_path(path.as_ref(), &hit.positions, path_start_offset);
411
412 path_start_offset += highlighted_text.1.char_count;
413 highlighted_text
414 })
415 .unzip();
416
417 let highlighted_match = HighlightedMatchWithPaths {
418 match_label: HighlightedText::join(match_labels.into_iter().flatten(), ", ").color(
419 if matches!(dev_server_status, Some(DevServerStatus::Offline)) {
420 Color::Disabled
421 } else {
422 Color::Default
423 },
424 ),
425 paths,
426 };
427
428 Some(
429 ListItem::new(ix)
430 .selected(selected)
431 .inset(true)
432 .spacing(ListItemSpacing::Sparse)
433 .child(
434 h_flex()
435 .flex_grow()
436 .gap_3()
437 .when(self.has_any_remote_projects, |this| {
438 this.child(if is_remote {
439 // if disabled, Color::Disabled
440 let indicator_color = match dev_server_status {
441 Some(DevServerStatus::Online) => Color::Created,
442 Some(DevServerStatus::Offline) => Color::Hidden,
443 _ => unreachable!(),
444 };
445 IconWithIndicator::new(
446 Icon::new(IconName::Server).color(Color::Muted),
447 Some(Indicator::dot()),
448 )
449 .indicator_color(indicator_color)
450 .indicator_border_color(if selected {
451 Some(cx.theme().colors().element_selected)
452 } else {
453 None
454 })
455 .into_any_element()
456 } else {
457 Icon::new(IconName::Screen)
458 .color(Color::Muted)
459 .into_any_element()
460 })
461 })
462 .child({
463 let mut highlighted = highlighted_match.clone();
464 if !self.render_paths {
465 highlighted.paths.clear();
466 }
467 highlighted.render(cx)
468 }),
469 )
470 .when(!is_current_workspace, |el| {
471 let delete_button = div()
472 .child(
473 IconButton::new("delete", IconName::Close)
474 .icon_size(IconSize::Small)
475 .on_click(cx.listener(move |this, _event, cx| {
476 cx.stop_propagation();
477 cx.prevent_default();
478
479 this.delegate.delete_recent_project(ix, cx)
480 }))
481 .tooltip(|cx| Tooltip::text("Delete from Recent Projects...", cx)),
482 )
483 .into_any_element();
484
485 if self.selected_index() == ix {
486 el.end_slot::<AnyElement>(delete_button)
487 } else {
488 el.end_hover_slot::<AnyElement>(delete_button)
489 }
490 })
491 .tooltip(move |cx| {
492 let tooltip_highlighted_location = highlighted_match.clone();
493 cx.new_view(move |_| MatchTooltip {
494 highlighted_location: tooltip_highlighted_location,
495 })
496 .into()
497 }),
498 )
499 }
500
501 fn render_footer(&self, cx: &mut ViewContext<Picker<Self>>) -> Option<AnyElement> {
502 if !cx.has_flag::<feature_flags::Remoting>() {
503 return None;
504 }
505 Some(
506 h_flex()
507 .border_t_1()
508 .py_2()
509 .pr_2()
510 .border_color(cx.theme().colors().border)
511 .justify_end()
512 .gap_4()
513 .child(
514 ButtonLike::new("remote")
515 .when_some(KeyBinding::for_action(&OpenRemote, cx), |button, key| {
516 button.child(key)
517 })
518 .child(Label::new("Connect remote…").color(Color::Muted))
519 .on_click(|_, cx| cx.dispatch_action(OpenRemote.boxed_clone())),
520 )
521 .child(
522 ButtonLike::new("local")
523 .when_some(
524 KeyBinding::for_action(&workspace::Open, cx),
525 |button, key| button.child(key),
526 )
527 .child(Label::new("Open folder…").color(Color::Muted))
528 .on_click(|_, cx| cx.dispatch_action(workspace::Open.boxed_clone())),
529 )
530 .into_any(),
531 )
532 }
533}
534
535// Compute the highlighted text for the name and path
536fn highlights_for_path(
537 path: &Path,
538 match_positions: &Vec<usize>,
539 path_start_offset: usize,
540) -> (Option<HighlightedText>, HighlightedText) {
541 let path_string = path.to_string_lossy();
542 let path_char_count = path_string.chars().count();
543 // Get the subset of match highlight positions that line up with the given path.
544 // Also adjusts them to start at the path start
545 let path_positions = match_positions
546 .iter()
547 .copied()
548 .skip_while(|position| *position < path_start_offset)
549 .take_while(|position| *position < path_start_offset + path_char_count)
550 .map(|position| position - path_start_offset)
551 .collect::<Vec<_>>();
552
553 // Again subset the highlight positions to just those that line up with the file_name
554 // again adjusted to the start of the file_name
555 let file_name_text_and_positions = path.file_name().map(|file_name| {
556 let text = file_name.to_string_lossy();
557 let char_count = text.chars().count();
558 let file_name_start = path_char_count - char_count;
559 let highlight_positions = path_positions
560 .iter()
561 .copied()
562 .skip_while(|position| *position < file_name_start)
563 .take_while(|position| *position < file_name_start + char_count)
564 .map(|position| position - file_name_start)
565 .collect::<Vec<_>>();
566 HighlightedText {
567 text: text.to_string(),
568 highlight_positions,
569 char_count,
570 color: Color::Default,
571 }
572 });
573
574 (
575 file_name_text_and_positions,
576 HighlightedText {
577 text: path_string.to_string(),
578 highlight_positions: path_positions,
579 char_count: path_char_count,
580 color: Color::Default,
581 },
582 )
583}
584
585impl RecentProjectsDelegate {
586 fn delete_recent_project(&self, ix: usize, cx: &mut ViewContext<Picker<Self>>) {
587 if let Some(selected_match) = self.matches.get(ix) {
588 let (workspace_id, _) = self.workspaces[selected_match.candidate_id];
589 cx.spawn(move |this, mut cx| async move {
590 let _ = WORKSPACE_DB.delete_workspace_by_id(workspace_id).await;
591 let workspaces = WORKSPACE_DB
592 .recent_workspaces_on_disk()
593 .await
594 .unwrap_or_default();
595 this.update(&mut cx, move |picker, cx| {
596 picker.delegate.set_workspaces(workspaces);
597 picker.delegate.set_selected_index(ix - 1, cx);
598 picker.delegate.reset_selected_match_index = false;
599 picker.update_matches(picker.query(cx), cx)
600 })
601 })
602 .detach();
603 }
604 }
605
606 fn is_current_workspace(
607 &self,
608 workspace_id: WorkspaceId,
609 cx: &mut ViewContext<Picker<Self>>,
610 ) -> bool {
611 if let Some(workspace) = self.workspace.upgrade() {
612 let workspace = workspace.read(cx);
613 if workspace_id == workspace.database_id() {
614 return true;
615 }
616 }
617
618 false
619 }
620}
621struct MatchTooltip {
622 highlighted_location: HighlightedMatchWithPaths,
623}
624
625impl Render for MatchTooltip {
626 fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
627 tooltip_container(cx, |div, _| {
628 self.highlighted_location.render_paths_children(div)
629 })
630 }
631}
632
633#[cfg(test)]
634mod tests {
635 use std::path::PathBuf;
636
637 use editor::Editor;
638 use gpui::{TestAppContext, WindowHandle};
639 use project::Project;
640 use serde_json::json;
641 use workspace::{open_paths, AppState, LocalPaths};
642
643 use super::*;
644
645 #[gpui::test]
646 async fn test_prompts_on_dirty_before_submit(cx: &mut TestAppContext) {
647 let app_state = init_test(cx);
648 app_state
649 .fs
650 .as_fake()
651 .insert_tree(
652 "/dir",
653 json!({
654 "main.ts": "a"
655 }),
656 )
657 .await;
658 cx.update(|cx| {
659 open_paths(
660 &[PathBuf::from("/dir/main.ts")],
661 app_state,
662 workspace::OpenOptions::default(),
663 cx,
664 )
665 })
666 .await
667 .unwrap();
668 assert_eq!(cx.update(|cx| cx.windows().len()), 1);
669
670 let workspace = cx.update(|cx| cx.windows()[0].downcast::<Workspace>().unwrap());
671 workspace
672 .update(cx, |workspace, _| assert!(!workspace.is_edited()))
673 .unwrap();
674
675 let editor = workspace
676 .read_with(cx, |workspace, cx| {
677 workspace
678 .active_item(cx)
679 .unwrap()
680 .downcast::<Editor>()
681 .unwrap()
682 })
683 .unwrap();
684 workspace
685 .update(cx, |_, cx| {
686 editor.update(cx, |editor, cx| editor.insert("EDIT", cx));
687 })
688 .unwrap();
689 workspace
690 .update(cx, |workspace, _| assert!(workspace.is_edited(), "After inserting more text into the editor without saving, we should have a dirty project"))
691 .unwrap();
692
693 let recent_projects_picker = open_recent_projects(&workspace, cx);
694 workspace
695 .update(cx, |_, cx| {
696 recent_projects_picker.update(cx, |picker, cx| {
697 assert_eq!(picker.query(cx), "");
698 let delegate = &mut picker.delegate;
699 delegate.matches = vec![StringMatch {
700 candidate_id: 0,
701 score: 1.0,
702 positions: Vec::new(),
703 string: "fake candidate".to_string(),
704 }];
705 delegate.set_workspaces(vec![(
706 WorkspaceId::default(),
707 LocalPaths::new(vec!["/test/path/"]).into(),
708 )]);
709 });
710 })
711 .unwrap();
712
713 assert!(
714 !cx.has_pending_prompt(),
715 "Should have no pending prompt on dirty project before opening the new recent project"
716 );
717 cx.dispatch_action(*workspace, menu::Confirm);
718 workspace
719 .update(cx, |workspace, cx| {
720 assert!(
721 workspace.active_modal::<RecentProjects>(cx).is_none(),
722 "Should remove the modal after selecting new recent project"
723 )
724 })
725 .unwrap();
726 assert!(
727 cx.has_pending_prompt(),
728 "Dirty workspace should prompt before opening the new recent project"
729 );
730 // Cancel
731 cx.simulate_prompt_answer(0);
732 assert!(
733 !cx.has_pending_prompt(),
734 "Should have no pending prompt after cancelling"
735 );
736 workspace
737 .update(cx, |workspace, _| {
738 assert!(
739 workspace.is_edited(),
740 "Should be in the same dirty project after cancelling"
741 )
742 })
743 .unwrap();
744 }
745
746 fn open_recent_projects(
747 workspace: &WindowHandle<Workspace>,
748 cx: &mut TestAppContext,
749 ) -> View<Picker<RecentProjectsDelegate>> {
750 cx.dispatch_action(
751 (*workspace).into(),
752 OpenRecent {
753 create_new_window: false,
754 },
755 );
756 workspace
757 .update(cx, |workspace, cx| {
758 workspace
759 .active_modal::<RecentProjects>(cx)
760 .unwrap()
761 .read(cx)
762 .picker
763 .clone()
764 })
765 .unwrap()
766 }
767
768 fn init_test(cx: &mut TestAppContext) -> Arc<AppState> {
769 cx.update(|cx| {
770 let state = AppState::test(cx);
771 language::init(cx);
772 crate::init(cx);
773 editor::init(cx);
774 workspace::init_settings(cx);
775 Project::init_settings(cx);
776 state
777 })
778 }
779}