@@ -2825,19 +2825,14 @@ impl AcpThreadView {
28252825 cx : & mut Context < Self > ,
28262826 ) -> AnyElement {
28272827 let ( message, action_slot) : ( SharedString , _ ) = match e {
2828- LoadError :: NotInstalled {
2829- error_message : _,
2830- install_message : _,
2831- install_command,
2832- } => {
2833- return self . render_not_installed ( install_command. clone ( ) , false , window, cx) ;
2828+ LoadError :: NotInstalled => {
2829+ return self . render_not_installed ( None , window, cx) ;
28342830 }
28352831 LoadError :: Unsupported {
2836- error_message : _,
2837- upgrade_message : _,
2838- upgrade_command,
2832+ command : path,
2833+ current_version,
28392834 } => {
2840- return self . render_not_installed ( upgrade_command . clone ( ) , true , window, cx) ;
2835+ return self . render_not_installed ( Some ( ( path , current_version ) ) , window, cx) ;
28412836 }
28422837 LoadError :: Exited { .. } => ( "Server exited with status {status}" . into ( ) , None ) ,
28432838 LoadError :: Other ( msg) => (
@@ -2855,8 +2850,11 @@ impl AcpThreadView {
28552850 . into_any_element ( )
28562851 }
28572852
2858- fn install_agent ( & self , install_command : String , window : & mut Window , cx : & mut Context < Self > ) {
2853+ fn install_agent ( & self , window : & mut Window , cx : & mut Context < Self > ) {
28592854 telemetry:: event!( "Agent Install CLI" , agent = self . agent. telemetry_id( ) ) ;
2855+ let Some ( install_command) = self . agent . install_command ( ) . map ( |s| s. to_owned ( ) ) else {
2856+ return ;
2857+ } ;
28602858 let task = self
28612859 . workspace
28622860 . update ( cx, |workspace, cx| {
@@ -2899,32 +2897,35 @@ impl AcpThreadView {
28992897
29002898 fn render_not_installed (
29012899 & self ,
2902- install_command : String ,
2903- is_upgrade : bool ,
2900+ existing_version : Option < ( & SharedString , & SharedString ) > ,
29042901 window : & mut Window ,
29052902 cx : & mut Context < Self > ,
29062903 ) -> AnyElement {
2904+ let install_command = self . agent . install_command ( ) . unwrap_or_default ( ) ;
2905+
29072906 self . install_command_markdown . update ( cx, |markdown, cx| {
29082907 if !markdown. source ( ) . contains ( & install_command) {
29092908 markdown. replace ( format ! ( "```\n {}\n ```" , install_command) , cx) ;
29102909 }
29112910 } ) ;
29122911
2913- let ( heading_label, description_label, button_label, or_label) = if is_upgrade {
2914- (
2915- "Upgrade Gemini CLI in Zed" ,
2916- "Get access to the latest version with support for Zed." ,
2917- "Upgrade Gemini CLI" ,
2918- "Or, to upgrade it manually:" ,
2919- )
2920- } else {
2921- (
2922- "Get Started with Gemini CLI in Zed" ,
2923- "Use Google's new coding agent directly in Zed." ,
2924- "Install Gemini CLI" ,
2925- "Or, to install it manually:" ,
2926- )
2927- } ;
2912+ let ( heading_label, description_label, button_label) =
2913+ if let Some ( ( path, version) ) = existing_version {
2914+ (
2915+ format ! ( "Upgrade {} to work with Zed" , self . agent. name( ) ) ,
2916+ format ! (
2917+ "Currently using {}, which is only version {}" ,
2918+ path, version
2919+ ) ,
2920+ format ! ( "Upgrade {}" , self . agent. name( ) ) ,
2921+ )
2922+ } else {
2923+ (
2924+ format ! ( "Get Started with {} in Zed" , self . agent. name( ) ) ,
2925+ "Use Google's new coding agent directly in Zed." . to_string ( ) ,
2926+ format ! ( "Install {}" , self . agent. name( ) ) ,
2927+ )
2928+ } ;
29282929
29292930 v_flex ( )
29302931 . w_full ( )
@@ -2954,12 +2955,10 @@ impl AcpThreadView {
29542955 . icon_color ( Color :: Muted )
29552956 . icon_size ( IconSize :: Small )
29562957 . icon_position ( IconPosition :: Start )
2957- . on_click ( cx. listener ( move |this, _, window, cx| {
2958- this. install_agent ( install_command. clone ( ) , window, cx)
2959- } ) ) ,
2958+ . on_click ( cx. listener ( |this, _, window, cx| this. install_agent ( window, cx) ) ) ,
29602959 )
29612960 . child (
2962- Label :: new ( or_label )
2961+ Label :: new ( "Or, run the following command in your terminal:" )
29632962 . size ( LabelSize :: Small )
29642963 . color ( Color :: Muted ) ,
29652964 )
@@ -5403,6 +5402,10 @@ pub(crate) mod tests {
54035402 "Test" . into ( )
54045403 }
54055404
5405+ fn install_command ( & self ) -> Option < & ' static str > {
5406+ None
5407+ }
5408+
54065409 fn connect (
54075410 & self ,
54085411 _root_dir : & Path ,
0 commit comments