@@ -697,6 +697,7 @@ impl SettingsObserver {
None => proto::LocalSettingsKind::Settings,
};
let path = RelPath::from_proto(&envelope.payload.path)?;
+ dbg!("got update worktree settings", &path);
this.update(&mut cx, |this, cx| {
let worktree_id = WorktreeId::from_proto(envelope.payload.worktree_id);
let Some(worktree) = this
@@ -844,6 +844,7 @@ impl SettingsStore {
settings_content: Option<&str>,
cx: &mut App,
) -> std::result::Result<(), InvalidSettingsError> {
+ dbg!(&kind, &directory_path);
let mut zed_settings_changed = false;
match (
kind,
@@ -958,6 +959,7 @@ impl SettingsStore {
}
};
+ dbg!(&self.local_settings);
if zed_settings_changed {
self.recompute_values(Some((root_id, &directory_path)), cx);
}
@@ -548,7 +548,6 @@ pub fn open_settings_editor(
}
// We have to defer this to get the workspace off the stack.
-
let path = path.map(ToOwned::to_owned);
cx.defer(move |cx| {
let current_rem_size: f32 = theme::ThemeSettings::get_global(cx).ui_font_size(cx).into();
@@ -1159,7 +1158,7 @@ fn all_language_names(cx: &App) -> Vec<SharedString> {
}
#[allow(unused)]
-#[derive(Clone, PartialEq)]
+#[derive(Clone, PartialEq, Debug)]
enum SettingsUiFile {
User, // Uses all settings.
Project((WorktreeId, Arc<RelPath>)), // Has a special name, and special set of settings
@@ -1823,7 +1822,7 @@ impl SettingsWindow {
let prev_files = self.files.clone();
let settings_store = cx.global::<SettingsStore>();
let mut ui_files = vec![];
- let mut all_files = settings_store.get_all_files();
+ let mut all_files = dbg!(settings_store.get_all_files());
if !all_files.contains(&settings::SettingsFile::User) {
all_files.push(settings::SettingsFile::User);
}
@@ -1836,14 +1835,12 @@ impl SettingsWindow {
}
if let Some(worktree_id) = settings_ui_file.worktree_id() {
- let directory_name = all_projects(cx)
- .find_map(|project| project.read(cx).worktree_for_id(worktree_id, cx))
- .and_then(|worktree| worktree.read(cx).root_dir())
- .and_then(|root_dir| {
- root_dir
- .file_name()
- .map(|os_string| os_string.to_string_lossy().to_string())
- });
+ let directory_name = dbg!(
+ all_projects(Some(window), cx)
+ .find_map(|project| dbg!(project.read(cx).worktree_for_id(worktree_id, cx)))
+ .map(|worktree| dbg!(worktree.read(cx).root_name()))
+ );
+ // .and_then(|root_dir| dbg!(dbg!(root_dir).file_name()));
let Some(directory_name) = directory_name else {
log::error!(
@@ -1853,7 +1850,8 @@ impl SettingsWindow {
continue;
};
- self.worktree_root_dirs.insert(worktree_id, directory_name);
+ self.worktree_root_dirs
+ .insert(worktree_id, directory_name.as_unix_str().to_string());
}
let focus_handle = prev_files
@@ -1869,7 +1867,7 @@ impl SettingsWindow {
let mut missing_worktrees = Vec::new();
- for worktree in all_projects(cx)
+ for worktree in all_projects(Some(window), cx)
.flat_map(|project| project.read(cx).worktrees(cx))
.filter(|tree| !self.worktree_root_dirs.contains_key(&tree.read(cx).id()))
{
@@ -1899,6 +1897,7 @@ impl SettingsWindow {
self.worktree_root_dirs.extend(missing_worktrees);
+ dbg!(&ui_files);
self.files = ui_files;
let current_file_still_exists = self
.files
@@ -3246,7 +3245,10 @@ impl Render for SettingsWindow {
}
}
-fn all_projects(cx: &App) -> impl Iterator<Item = Entity<project::Project>> {
+fn all_projects(
+ window: Option<&Window>,
+ cx: &App,
+) -> impl Iterator<Item = Entity<project::Project>> {
workspace::AppState::global(cx)
.upgrade()
.map(|app_state| {
@@ -3255,7 +3257,15 @@ fn all_projects(cx: &App) -> impl Iterator<Item = Entity<project::Project>> {
.read(cx)
.workspaces()
.iter()
+ .inspect(|_| {
+ dbg!("workspace");
+ })
.filter_map(|workspace| Some(workspace.read(cx).ok()?.project().clone()))
+ .chain(
+ dbg!(window.and_then(|window| dbg!(window.root::<Workspace>())))
+ .flatten()
+ .map(|workspace| workspace.read(cx).project().clone()),
+ )
})
.into_iter()
.flatten()
@@ -3272,7 +3282,7 @@ fn update_settings_file(
match file {
SettingsUiFile::Project((worktree_id, rel_path)) => {
let rel_path = rel_path.join(paths::local_settings_file_relative_path());
- let Some((worktree, project)) = all_projects(cx).find_map(|project| {
+ let Some((worktree, project)) = all_projects(None, cx).find_map(|project| {
project
.read(cx)
.worktree_for_id(worktree_id, cx)