Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix duplicate WSL entries (#40255)

localcc07ccff217a16
diff --git a/crates/recent_projects/src/remote_servers.rs b/crates/recent_projects/src/remote_servers.rs
index 9eb18bcac15..871be06684c 100644
--- a/crates/recent_projects/src/remote_servers.rs
+++ b/crates/recent_projects/src/remote_servers.rs
@@ -1385,14 +1385,21 @@ impl RemoteServerProjects {
cx: &mut Context<Self>,
) {
self.update_settings_file(cx, move |setting, _| {
- setting
- .wsl_connections
- .get_or_insert(Default::default())
- .push(settings::WslConnection {
- distro_name: SharedString::from(connection_options.distro_name),
- user: connection_options.user,
+ let connections = setting.wsl_connections.get_or_insert(Default::default());
+
+ let distro_name = SharedString::from(connection_options.distro_name);
+ let user = connection_options.user;
+
+ if !connections
+ .iter()
+ .any(|conn| conn.distro_name == distro_name && conn.user == user)
+ {
+ connections.push(settings::WslConnection {
+ distro_name,
+ user,
projects: BTreeSet::new(),
})
+ }
});
}