@@ -2,12 +2,12 @@ use std::sync::Arc;
22
33use editor:: Editor ;
44use gpui:: {
5- AsyncWindowContext , Context , Entity , IntoElement , ParentElement , Render , Subscription , Task ,
6- WeakEntity , Window , div,
5+ AsyncWindowContext , Context , Entity , IntoElement , ParentElement , Render , Styled , Subscription ,
6+ Task , WeakEntity , Window , div,
77} ;
88use language:: { Buffer , BufferEvent , LanguageName , Toolchain , ToolchainScope } ;
99use project:: { Project , ProjectPath , Toolchains , WorktreeId , toolchain_store:: ToolchainStoreEvent } ;
10- use ui:: { Button , ButtonCommon , Clickable , FluentBuilder , LabelSize , SharedString , Tooltip } ;
10+ use ui:: { Button , ButtonCommon , Clickable , LabelSize , SharedString , Tooltip } ;
1111use util:: { maybe, rel_path:: RelPath } ;
1212use workspace:: { StatusItemView , Workspace , item:: ItemHandle } ;
1313
@@ -230,21 +230,22 @@ impl ActiveToolchain {
230230
231231impl Render for ActiveToolchain {
232232 fn render ( & mut self , _window : & mut Window , cx : & mut Context < Self > ) -> impl IntoElement {
233- div ( ) . when_some ( self . active_toolchain . as_ref ( ) , |el, active_toolchain| {
234- let term = self . term . clone ( ) ;
235- el. child (
236- Button :: new ( "change-toolchain" , active_toolchain. name . clone ( ) )
237- . label_size ( LabelSize :: Small )
238- . on_click ( cx. listener ( |this, _, window, cx| {
239- if let Some ( workspace) = this. workspace . upgrade ( ) {
240- workspace. update ( cx, |workspace, cx| {
241- ToolchainSelector :: toggle ( workspace, window, cx)
242- } ) ;
243- }
244- } ) )
245- . tooltip ( Tooltip :: text ( format ! ( "Select {}" , & term) ) ) ,
246- )
247- } )
233+ let Some ( active_toolchain) = self . active_toolchain . as_ref ( ) else {
234+ return div ( ) . none ( ) ;
235+ } ;
236+
237+ div ( ) . child (
238+ Button :: new ( "change-toolchain" , active_toolchain. name . clone ( ) )
239+ . label_size ( LabelSize :: Small )
240+ . on_click ( cx. listener ( |this, _, window, cx| {
241+ if let Some ( workspace) = this. workspace . upgrade ( ) {
242+ workspace. update ( cx, |workspace, cx| {
243+ ToolchainSelector :: toggle ( workspace, window, cx)
244+ } ) ;
245+ }
246+ } ) )
247+ . tooltip ( Tooltip :: text ( format ! ( "Select {}" , & self . term) ) ) ,
248+ )
248249 }
249250}
250251
0 commit comments