settings: Skip terminal env vars with substitutions in vscode import (#42464)

Closes https://github.com/zed-industries/zed/issues/40547

Release Notes:

- Fixed vscode import creating faulty terminal env vars in terminal
settings
This commit is contained in:
Lukas Wirth
2025-11-11 16:15:12 +00:00
committed by GitHub
parent 03acbb7de3
commit 83351283e4
3 changed files with 17 additions and 5 deletions
+1 -3
View File
@@ -350,8 +350,7 @@ impl AutoUpdater {
pub fn start_polling(&self, cx: &mut Context<Self>) -> Task<Result<()>> {
cx.spawn(async move |this, cx| {
#[cfg(target_os = "windows")]
{
if cfg!(target_os = "windows") {
use util::ResultExt;
cleanup_windows()
@@ -903,7 +902,6 @@ async fn install_release_macos(
Ok(None)
}
#[cfg(target_os = "windows")]
async fn cleanup_windows() -> Result<()> {
let parent = std::env::current_exe()?
.parent()
+7 -1
View File
@@ -753,7 +753,13 @@ impl VsCodeSettings {
let env = self
.read_value(&format!("terminal.integrated.env.{platform}"))
.and_then(|v| v.as_object())
.map(|v| v.iter().map(|(k, v)| (k.clone(), v.to_string())).collect());
.map(|v| {
v.iter()
.map(|(k, v)| (k.clone(), v.to_string()))
// zed does not support substitutions, so this can break env vars
.filter(|(_, v)| !v.contains('$'))
.collect()
});
ProjectTerminalSettingsContent {
// TODO: handle arguments
+9 -1
View File
@@ -1386,7 +1386,15 @@ impl Terminal {
/// (This is a no-op for display-only terminals.)
fn write_to_pty(&self, input: impl Into<Cow<'static, [u8]>>) {
if let TerminalType::Pty { pty_tx, .. } = &self.terminal_type {
pty_tx.notify(input.into());
let input = input.into();
if log::log_enabled!(log::Level::Debug) {
if let Ok(str) = str::from_utf8(&input) {
log::debug!("Writing to PTY: {:?}", str);
} else {
log::debug!("Writing to PTY: {:?}", input);
}
}
pty_tx.notify(input);
}
}