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.

terminal: Set `TERM_PROGRAM` and `TERM_PROGRAM_VERSION` environment variables in integrated terminal (#14213)

Donough Liud49727ff100d
diff --git a/Cargo.lock b/Cargo.lock
index e99a440e6b2..2406785e670 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -10737,6 +10737,7 @@ dependencies = [
"gpui",
"libc",
"rand 0.8.5",
+ "release_channel",
"schemars",
"serde",
"serde_derive",
diff --git a/crates/project/src/terminals.rs b/crates/project/src/terminals.rs
index 91851b80b34..40423c26f74 100644
--- a/crates/project/src/terminals.rs
+++ b/crates/project/src/terminals.rs
@@ -180,6 +180,7 @@ impl Project {
settings.max_scroll_history_lines,
window,
completion_tx,
+ cx,
)
.map(|builder| {
let terminal_handle = cx.new_model(|cx| builder.subscribe(cx));
diff --git a/crates/terminal/Cargo.toml b/crates/terminal/Cargo.toml
index 994702a446b..958207bce93 100644
--- a/crates/terminal/Cargo.toml
+++ b/crates/terminal/Cargo.toml
@@ -21,7 +21,7 @@ dirs.workspace = true
futures.workspace = true
gpui.workspace = true
libc.workspace = true
-task.workspace = true
+release_channel.workspace = true
schemars.workspace = true
serde.workspace = true
serde_derive.workspace = true
@@ -29,6 +29,7 @@ serde_json.workspace = true
settings.workspace = true
sysinfo.workspace = true
smol.workspace = true
+task.workspace = true
theme.workspace = true
thiserror.workspace = true
util.workspace = true
diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs
index d66be6c4741..3fedfcf4be7 100644
--- a/crates/terminal/src/terminal.rs
+++ b/crates/terminal/src/terminal.rs
@@ -319,12 +319,18 @@ impl TerminalBuilder {
max_scroll_history_lines: Option<usize>,
window: AnyWindowHandle,
completion_tx: Sender<()>,
+ cx: &mut AppContext,
) -> Result<TerminalBuilder> {
// TODO: Properly set the current locale,
env.entry("LC_ALL".to_string())
.or_insert_with(|| "en_US.UTF-8".to_string());
env.insert("ZED_TERM".to_string(), "true".to_string());
+ env.insert("TERM_PROGRAM".to_string(), "zed".to_string());
+ env.insert(
+ "TERM_PROGRAM_VERSION".to_string(),
+ release_channel::AppVersion::global(cx).to_string(),
+ );
let pty_options = {
let alac_shell = match shell.clone() {