Rework remote task synchronization (#18746)
Reworks the way tasks are stored, accessed and synchronized in the `project`. Now both collab and ssh remote projects use the same TaskStorage kind to get the task context from the remote host, and worktree task templates are synchronized along with other worktree settings. Release Notes: - Adds ssh support to tasks, improves collab-remote projects' tasks sync
This commit is contained in:
parent
f1053ff525
commit
49c75eb062
18 changed files with 1262 additions and 1366 deletions
|
@ -14,8 +14,8 @@ pub use json_schema::*;
|
|||
pub use keymap_file::KeymapFile;
|
||||
pub use settings_file::*;
|
||||
pub use settings_store::{
|
||||
InvalidSettingsError, LocalSettingsKind, Settings, SettingsLocation, SettingsSources,
|
||||
SettingsStore,
|
||||
parse_json_with_comments, InvalidSettingsError, LocalSettingsKind, Settings, SettingsLocation,
|
||||
SettingsSources, SettingsStore,
|
||||
};
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash, PartialOrd, Ord)]
|
||||
|
|
|
@ -515,13 +515,11 @@ impl SettingsStore {
|
|||
} else {
|
||||
parse_json_with_comments(user_settings_content)?
|
||||
};
|
||||
if settings.is_object() {
|
||||
self.raw_user_settings = settings;
|
||||
self.recompute_values(None, cx)?;
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!("settings must be an object"))
|
||||
}
|
||||
|
||||
anyhow::ensure!(settings.is_object(), "settings must be an object");
|
||||
self.raw_user_settings = settings;
|
||||
self.recompute_values(None, cx)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Add or remove a set of local settings via a JSON string.
|
||||
|
@ -533,16 +531,29 @@ impl SettingsStore {
|
|||
settings_content: Option<&str>,
|
||||
cx: &mut AppContext,
|
||||
) -> Result<()> {
|
||||
anyhow::ensure!(
|
||||
kind != LocalSettingsKind::Tasks,
|
||||
"Attempted to submit tasks into the settings store"
|
||||
);
|
||||
|
||||
let raw_local_settings = self
|
||||
.raw_local_settings
|
||||
.entry((root_id, directory_path.clone()))
|
||||
.or_default();
|
||||
if settings_content.is_some_and(|content| !content.is_empty()) {
|
||||
raw_local_settings.insert(kind, parse_json_with_comments(settings_content.unwrap())?);
|
||||
let changed = if settings_content.is_some_and(|content| !content.is_empty()) {
|
||||
let new_contents = parse_json_with_comments(settings_content.unwrap())?;
|
||||
if Some(&new_contents) == raw_local_settings.get(&kind) {
|
||||
false
|
||||
} else {
|
||||
raw_local_settings.insert(kind, new_contents);
|
||||
true
|
||||
}
|
||||
} else {
|
||||
raw_local_settings.remove(&kind);
|
||||
raw_local_settings.remove(&kind).is_some()
|
||||
};
|
||||
if changed {
|
||||
self.recompute_values(Some((root_id, &directory_path)), cx)?;
|
||||
}
|
||||
self.recompute_values(Some((root_id, &directory_path)), cx)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue