Make remote projects to sync in local user settings (#37560)

Closes https://github.com/zed-industries/zed/issues/20024
Closes https://github.com/zed-industries/zed/issues/23489



https://github.com/user-attachments/assets/6466e0c1-4188-4980-8bb6-52ef6e7591c9


Release Notes:

- Made remote projects to sync in local user settings
This commit is contained in:
Kirill Bulatov
2025-09-04 19:05:21 +00:00
committed by GitHub
parent a85946eba8
commit 223fda2fe2
8 changed files with 105 additions and 45 deletions
@@ -280,7 +280,8 @@ async fn test_remote_settings(cx: &mut TestAppContext, server_cx: &mut TestAppCo
AllLanguageSettings::get_global(cx)
.language(None, Some(&"Rust".into()), cx)
.language_servers,
["..."] // local settings are ignored
["from-local-settings"],
"User language settings should be synchronized with the server settings"
)
});
@@ -300,7 +301,8 @@ async fn test_remote_settings(cx: &mut TestAppContext, server_cx: &mut TestAppCo
AllLanguageSettings::get_global(cx)
.language(None, Some(&"Rust".into()), cx)
.language_servers,
["from-server-settings".to_string()]
["from-server-settings".to_string()],
"Server language settings should take precedence over the user settings"
)
});
+26 -22
View File
@@ -918,29 +918,33 @@ fn initialize_settings(
});
let (mut tx, rx) = watch::channel(None);
let mut node_settings = None;
cx.observe_global::<SettingsStore>(move |cx| {
let settings = &ProjectSettings::get_global(cx).node;
log::info!("Got new node settings: {:?}", settings);
let options = NodeBinaryOptions {
allow_path_lookup: !settings.ignore_system_version,
// TODO: Implement this setting
allow_binary_download: true,
use_paths: settings.path.as_ref().map(|node_path| {
let node_path = PathBuf::from(shellexpand::tilde(node_path).as_ref());
let npm_path = settings
.npm_path
.as_ref()
.map(|path| PathBuf::from(shellexpand::tilde(&path).as_ref()));
(
node_path.clone(),
npm_path.unwrap_or_else(|| {
let base_path = PathBuf::new();
node_path.parent().unwrap_or(&base_path).join("npm")
}),
)
}),
};
tx.send(Some(options)).log_err();
let new_node_settings = &ProjectSettings::get_global(cx).node;
if Some(new_node_settings) != node_settings.as_ref() {
log::info!("Got new node settings: {new_node_settings:?}");
let options = NodeBinaryOptions {
allow_path_lookup: !new_node_settings.ignore_system_version,
// TODO: Implement this setting
allow_binary_download: true,
use_paths: new_node_settings.path.as_ref().map(|node_path| {
let node_path = PathBuf::from(shellexpand::tilde(node_path).as_ref());
let npm_path = new_node_settings
.npm_path
.as_ref()
.map(|path| PathBuf::from(shellexpand::tilde(&path).as_ref()));
(
node_path.clone(),
npm_path.unwrap_or_else(|| {
let base_path = PathBuf::new();
node_path.parent().unwrap_or(&base_path).join("npm")
}),
)
}),
};
node_settings = Some(new_node_settings.clone());
tx.send(Some(options)).ok();
}
})
.detach();