fmt
This commit is contained in:
parent
8be12051f9
commit
bae3ed8522
7 changed files with 109 additions and 117 deletions
|
@ -6,8 +6,8 @@ use settings::{Settings, SettingsSources};
|
||||||
use std::{fmt::Write, num::NonZeroU32, time::Duration};
|
use std::{fmt::Write, num::NonZeroU32, time::Duration};
|
||||||
use text::{Point, Selection};
|
use text::{Point, Selection};
|
||||||
use ui::{
|
use ui::{
|
||||||
Button, ButtonCommon, Clickable, Context, DynamicSpacing, FluentBuilder, IntoElement, LabelSize, ParentElement,
|
Button, ButtonCommon, Clickable, Context, DynamicSpacing, FluentBuilder, IntoElement,
|
||||||
Render, Tooltip, Window, div,
|
LabelSize, ParentElement, Render, Tooltip, Window, div,
|
||||||
};
|
};
|
||||||
use util::paths::FILE_ROW_COLUMN_DELIMITER;
|
use util::paths::FILE_ROW_COLUMN_DELIMITER;
|
||||||
use workspace::{StatusItemView, Workspace, item::ItemHandle};
|
use workspace::{StatusItemView, Workspace, item::ItemHandle};
|
||||||
|
@ -223,41 +223,39 @@ impl Render for CursorPosition {
|
||||||
|
|
||||||
let context = self.context.clone();
|
let context = self.context.clone();
|
||||||
|
|
||||||
el
|
el.py(DynamicSpacing::Base04.rems(cx)).child(
|
||||||
.py(DynamicSpacing::Base04.rems(cx))
|
Button::new("go-to-line-column", text)
|
||||||
.child(
|
.label_size(LabelSize::Small)
|
||||||
Button::new("go-to-line-column", text)
|
.on_click(cx.listener(|this, _, window, cx| {
|
||||||
.label_size(LabelSize::Small)
|
if let Some(workspace) = this.workspace.upgrade() {
|
||||||
.on_click(cx.listener(|this, _, window, cx| {
|
workspace.update(cx, |workspace, cx| {
|
||||||
if let Some(workspace) = this.workspace.upgrade() {
|
if let Some(editor) = workspace
|
||||||
workspace.update(cx, |workspace, cx| {
|
.active_item(cx)
|
||||||
if let Some(editor) = workspace
|
.and_then(|item| item.act_as::<Editor>(cx))
|
||||||
.active_item(cx)
|
&& let Some((_, buffer, _)) = editor.read(cx).active_excerpt(cx)
|
||||||
.and_then(|item| item.act_as::<Editor>(cx))
|
{
|
||||||
&& let Some((_, buffer, _)) = editor.read(cx).active_excerpt(cx)
|
workspace.toggle_modal(window, cx, |window, cx| {
|
||||||
{
|
crate::GoToLine::new(editor, buffer, window, cx)
|
||||||
workspace.toggle_modal(window, cx, |window, cx| {
|
})
|
||||||
crate::GoToLine::new(editor, buffer, window, cx)
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
});
|
}))
|
||||||
}
|
.tooltip(move |window, cx| match context.as_ref() {
|
||||||
}))
|
Some(context) => Tooltip::for_action_in(
|
||||||
.tooltip(move |window, cx| match context.as_ref() {
|
"Go to Line/Column",
|
||||||
Some(context) => Tooltip::for_action_in(
|
&editor::actions::ToggleGoToLine,
|
||||||
"Go to Line/Column",
|
context,
|
||||||
&editor::actions::ToggleGoToLine,
|
window,
|
||||||
context,
|
cx,
|
||||||
window,
|
),
|
||||||
cx,
|
None => Tooltip::for_action(
|
||||||
),
|
"Go to Line/Column",
|
||||||
None => Tooltip::for_action(
|
&editor::actions::ToggleGoToLine,
|
||||||
"Go to Line/Column",
|
window,
|
||||||
&editor::actions::ToggleGoToLine,
|
cx,
|
||||||
window,
|
),
|
||||||
cx,
|
}),
|
||||||
),
|
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,11 +77,9 @@ impl Render for ImageInfo {
|
||||||
.to_string(),
|
.to_string(),
|
||||||
);
|
);
|
||||||
|
|
||||||
div()
|
div().py(DynamicSpacing::Base04.rems(cx)).child(
|
||||||
.py(DynamicSpacing::Base04.rems(cx))
|
Button::new("image-metadata", components.join(" • ")).label_size(LabelSize::Small),
|
||||||
.child(
|
)
|
||||||
Button::new("image-metadata", components.join(" • ")).label_size(LabelSize::Small),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use editor::{Editor, EditorSettings};
|
use editor::{Editor, EditorSettings};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
Context, Entity, IntoElement, ParentElement, Render, Styled, Subscription, WeakEntity, Window, div,
|
Context, Entity, IntoElement, ParentElement, Render, Styled, Subscription, WeakEntity, Window,
|
||||||
|
div,
|
||||||
};
|
};
|
||||||
use language::LanguageName;
|
use language::LanguageName;
|
||||||
use settings::Settings as _;
|
use settings::Settings as _;
|
||||||
|
@ -54,22 +55,20 @@ impl Render for ActiveBufferLanguage {
|
||||||
"Unknown".to_string()
|
"Unknown".to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
el
|
el.py(DynamicSpacing::Base04.rems(cx)).child(
|
||||||
.py(DynamicSpacing::Base04.rems(cx))
|
Button::new("change-language", active_language_text)
|
||||||
.child(
|
.label_size(LabelSize::Small)
|
||||||
Button::new("change-language", active_language_text)
|
.on_click(cx.listener(|this, _, window, cx| {
|
||||||
.label_size(LabelSize::Small)
|
if let Some(workspace) = this.workspace.upgrade() {
|
||||||
.on_click(cx.listener(|this, _, window, cx| {
|
workspace.update(cx, |workspace, cx| {
|
||||||
if let Some(workspace) = this.workspace.upgrade() {
|
LanguageSelector::toggle(workspace, window, cx)
|
||||||
workspace.update(cx, |workspace, cx| {
|
});
|
||||||
LanguageSelector::toggle(workspace, window, cx)
|
}
|
||||||
});
|
}))
|
||||||
}
|
.tooltip(|window, cx| {
|
||||||
}))
|
Tooltip::for_action("Select Language", &Toggle, window, cx)
|
||||||
.tooltip(|window, cx| {
|
}),
|
||||||
Tooltip::for_action("Select Language", &Toggle, window, cx)
|
)
|
||||||
}),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1007,28 +1007,26 @@ impl Render for LspTool {
|
||||||
|
|
||||||
let lsp_tool = cx.entity();
|
let lsp_tool = cx.entity();
|
||||||
|
|
||||||
div()
|
div().py(DynamicSpacing::Base04.rems(cx)).child(
|
||||||
.py(DynamicSpacing::Base04.rems(cx))
|
PopoverMenu::new("lsp-tool")
|
||||||
.child(
|
.menu(move |_, cx| lsp_tool.read(cx).lsp_menu.clone())
|
||||||
PopoverMenu::new("lsp-tool")
|
.anchor(Corner::BottomLeft)
|
||||||
.menu(move |_, cx| lsp_tool.read(cx).lsp_menu.clone())
|
.with_handle(self.popover_menu_handle.clone())
|
||||||
.anchor(Corner::BottomLeft)
|
.trigger_with_tooltip(
|
||||||
.with_handle(self.popover_menu_handle.clone())
|
IconButton::new("zed-lsp-tool-button", IconName::BoltOutlined)
|
||||||
.trigger_with_tooltip(
|
.when_some(indicator, IconButton::indicator)
|
||||||
IconButton::new("zed-lsp-tool-button", IconName::BoltOutlined)
|
.icon_size(IconSize::Small)
|
||||||
.when_some(indicator, IconButton::indicator)
|
.indicator_border_color(Some(cx.theme().colors().status_bar_background)),
|
||||||
.icon_size(IconSize::Small)
|
move |window, cx| {
|
||||||
.indicator_border_color(Some(cx.theme().colors().status_bar_background)),
|
Tooltip::with_meta(
|
||||||
move |window, cx| {
|
"Language Servers",
|
||||||
Tooltip::with_meta(
|
Some(&ToggleMenu),
|
||||||
"Language Servers",
|
description,
|
||||||
Some(&ToggleMenu),
|
window,
|
||||||
description,
|
cx,
|
||||||
window,
|
)
|
||||||
cx,
|
},
|
||||||
)
|
),
|
||||||
},
|
)
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,23 +21,21 @@ impl Render for SearchButton {
|
||||||
return button.w_0().invisible();
|
return button.w_0().invisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
button
|
button.py(DynamicSpacing::Base04.rems(cx)).child(
|
||||||
.py(DynamicSpacing::Base04.rems(cx))
|
IconButton::new("project-search-indicator", SEARCH_ICON)
|
||||||
.child(
|
.icon_size(IconSize::Small)
|
||||||
IconButton::new("project-search-indicator", SEARCH_ICON)
|
.tooltip(|window, cx| {
|
||||||
.icon_size(IconSize::Small)
|
Tooltip::for_action(
|
||||||
.tooltip(|window, cx| {
|
"Project Search",
|
||||||
Tooltip::for_action(
|
&workspace::DeploySearch::default(),
|
||||||
"Project Search",
|
window,
|
||||||
&workspace::DeploySearch::default(),
|
cx,
|
||||||
window,
|
)
|
||||||
cx,
|
})
|
||||||
)
|
.on_click(cx.listener(|_this, _, window, cx| {
|
||||||
})
|
window.dispatch_action(Box::new(workspace::DeploySearch::default()), cx);
|
||||||
.on_click(cx.listener(|_this, _, window, cx| {
|
})),
|
||||||
window.dispatch_action(Box::new(workspace::DeploySearch::default()), cx);
|
)
|
||||||
})),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,15 @@ use std::{path::Path, sync::Arc};
|
||||||
|
|
||||||
use editor::Editor;
|
use editor::Editor;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AsyncWindowContext, Context, Entity, IntoElement, ParentElement, Render, Styled, Subscription, Task,
|
AsyncWindowContext, Context, Entity, IntoElement, ParentElement, Render, Styled, Subscription,
|
||||||
WeakEntity, Window, div,
|
Task, WeakEntity, Window, div,
|
||||||
};
|
};
|
||||||
use language::{Buffer, BufferEvent, LanguageName, Toolchain};
|
use language::{Buffer, BufferEvent, LanguageName, Toolchain};
|
||||||
use project::{Project, ProjectPath, WorktreeId, toolchain_store::ToolchainStoreEvent};
|
use project::{Project, ProjectPath, WorktreeId, toolchain_store::ToolchainStoreEvent};
|
||||||
use ui::{Button, ButtonCommon, Clickable, DynamicSpacing, FluentBuilder, LabelSize, SharedString, Tooltip};
|
use ui::{
|
||||||
|
Button, ButtonCommon, Clickable, DynamicSpacing, FluentBuilder, LabelSize, SharedString,
|
||||||
|
Tooltip,
|
||||||
|
};
|
||||||
use util::maybe;
|
use util::maybe;
|
||||||
use workspace::{StatusItemView, Workspace, item::ItemHandle};
|
use workspace::{StatusItemView, Workspace, item::ItemHandle};
|
||||||
|
|
||||||
|
@ -219,20 +222,18 @@ impl Render for ActiveToolchain {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
div().when_some(self.active_toolchain.as_ref(), |el, active_toolchain| {
|
div().when_some(self.active_toolchain.as_ref(), |el, active_toolchain| {
|
||||||
let term = self.term.clone();
|
let term = self.term.clone();
|
||||||
el
|
el.py(DynamicSpacing::Base04.rems(cx)).child(
|
||||||
.py(DynamicSpacing::Base04.rems(cx))
|
Button::new("change-toolchain", active_toolchain.name.clone())
|
||||||
.child(
|
.label_size(LabelSize::Small)
|
||||||
Button::new("change-toolchain", active_toolchain.name.clone())
|
.on_click(cx.listener(|this, _, window, cx| {
|
||||||
.label_size(LabelSize::Small)
|
if let Some(workspace) = this.workspace.upgrade() {
|
||||||
.on_click(cx.listener(|this, _, window, cx| {
|
workspace.update(cx, |workspace, cx| {
|
||||||
if let Some(workspace) = this.workspace.upgrade() {
|
ToolchainSelector::toggle(workspace, window, cx)
|
||||||
workspace.update(cx, |workspace, cx| {
|
});
|
||||||
ToolchainSelector::toggle(workspace, window, cx)
|
}
|
||||||
});
|
}))
|
||||||
}
|
.tooltip(Tooltip::text(format!("Select {}", &term))),
|
||||||
}))
|
)
|
||||||
.tooltip(Tooltip::text(format!("Select {}", &term))),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ impl Render for ModeIndicator {
|
||||||
Label::new(label)
|
Label::new(label)
|
||||||
.size(LabelSize::Small)
|
.size(LabelSize::Small)
|
||||||
.line_height_style(LineHeightStyle::UiLabel)
|
.line_height_style(LineHeightStyle::UiLabel)
|
||||||
.into_any_element()
|
.into_any_element(),
|
||||||
)
|
)
|
||||||
.into_any_element()
|
.into_any_element()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue