Merge branch 'main' into lsp-file-change-notifications
This commit is contained in:
commit
027def6800
13 changed files with 70 additions and 40 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -8439,7 +8439,7 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zed"
|
name = "zed"
|
||||||
version = "0.79.0"
|
version = "0.80.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activity_indicator",
|
"activity_indicator",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
|
|
@ -89,7 +89,7 @@ impl View for CollabTitlebarItem {
|
||||||
let theme = cx.global::<Settings>().theme.clone();
|
let theme = cx.global::<Settings>().theme.clone();
|
||||||
|
|
||||||
let mut left_container = Flex::row();
|
let mut left_container = Flex::row();
|
||||||
let mut right_container = Flex::row();
|
let mut right_container = Flex::row().align_children_center();
|
||||||
|
|
||||||
left_container.add_child(
|
left_container.add_child(
|
||||||
Label::new(project_title, theme.workspace.titlebar.title.clone())
|
Label::new(project_title, theme.workspace.titlebar.title.clone())
|
||||||
|
@ -117,6 +117,7 @@ impl View for CollabTitlebarItem {
|
||||||
|
|
||||||
let status = workspace.read(cx).client().status();
|
let status = workspace.read(cx).client().status();
|
||||||
let status = &*status.borrow();
|
let status = &*status.borrow();
|
||||||
|
|
||||||
if matches!(status, client::Status::Connected { .. }) {
|
if matches!(status, client::Status::Connected { .. }) {
|
||||||
right_container.add_child(self.render_toggle_contacts_button(&theme, cx));
|
right_container.add_child(self.render_toggle_contacts_button(&theme, cx));
|
||||||
right_container.add_child(self.render_user_menu_button(&theme, cx));
|
right_container.add_child(self.render_user_menu_button(&theme, cx));
|
||||||
|
|
|
@ -21,6 +21,8 @@ pub fn init(cx: &mut MutableAppContext) {
|
||||||
} else if let Some((window_id, _)) = status_indicator.take() {
|
} else if let Some((window_id, _)) = status_indicator.take() {
|
||||||
cx.remove_status_bar_item(window_id);
|
cx.remove_status_bar_item(window_id);
|
||||||
}
|
}
|
||||||
|
} else if let Some((window_id, _)) = status_indicator.take() {
|
||||||
|
cx.remove_status_bar_item(window_id);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|
|
@ -576,13 +576,16 @@ impl EditorElement {
|
||||||
|
|
||||||
for (ix, fold_indicator) in layout.fold_indicators.iter_mut().enumerate() {
|
for (ix, fold_indicator) in layout.fold_indicators.iter_mut().enumerate() {
|
||||||
if let Some(indicator) = fold_indicator.as_mut() {
|
if let Some(indicator) = fold_indicator.as_mut() {
|
||||||
let mut x = bounds.width() - layout.gutter_padding;
|
let position = vec2f(
|
||||||
let mut y = ix as f32 * line_height - scroll_top;
|
bounds.width() - layout.gutter_padding,
|
||||||
|
ix as f32 * line_height - (scroll_top % line_height),
|
||||||
|
);
|
||||||
|
let centering_offset = vec2f(
|
||||||
|
(layout.gutter_padding + layout.gutter_margin - indicator.size().x()) / 2.,
|
||||||
|
(line_height - indicator.size().y()) / 2.,
|
||||||
|
);
|
||||||
|
|
||||||
x += ((layout.gutter_padding + layout.gutter_margin) - indicator.size().x()) / 2.;
|
let indicator_origin = bounds.origin() + position + centering_offset;
|
||||||
y += (line_height - indicator.size().y()) / 2.;
|
|
||||||
|
|
||||||
let indicator_origin = bounds.origin() + vec2f(x, y);
|
|
||||||
|
|
||||||
indicator.paint(indicator_origin, visible_bounds, cx);
|
indicator.paint(indicator_origin, visible_bounds, cx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ use std::sync::Arc;
|
||||||
use workspace::{item::ItemHandle, StatusItemView};
|
use workspace::{item::ItemHandle, StatusItemView};
|
||||||
|
|
||||||
pub struct ActiveBufferLanguage {
|
pub struct ActiveBufferLanguage {
|
||||||
active_language: Option<Arc<str>>,
|
active_language: Option<Option<Arc<str>>>,
|
||||||
_observe_active_editor: Option<Subscription>,
|
_observe_active_editor: Option<Subscription>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,12 +27,12 @@ impl ActiveBufferLanguage {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_language(&mut self, editor: ViewHandle<Editor>, cx: &mut ViewContext<Self>) {
|
fn update_language(&mut self, editor: ViewHandle<Editor>, cx: &mut ViewContext<Self>) {
|
||||||
self.active_language.take();
|
self.active_language = Some(None);
|
||||||
|
|
||||||
let editor = editor.read(cx);
|
let editor = editor.read(cx);
|
||||||
if let Some((_, buffer, _)) = editor.active_excerpt(cx) {
|
if let Some((_, buffer, _)) = editor.active_excerpt(cx) {
|
||||||
if let Some(language) = buffer.read(cx).language() {
|
if let Some(language) = buffer.read(cx).language() {
|
||||||
self.active_language = Some(language.name());
|
self.active_language = Some(Some(language.name()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,23 +50,27 @@ impl View for ActiveBufferLanguage {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
|
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
|
||||||
let active_language = if let Some(active_language) = self.active_language.as_ref() {
|
if let Some(active_language) = self.active_language.as_ref() {
|
||||||
active_language.to_string()
|
let active_language_text = if let Some(active_language_text) = active_language {
|
||||||
} else {
|
active_language_text.to_string()
|
||||||
"Unkown".to_string()
|
} else {
|
||||||
};
|
"Unknown".to_string()
|
||||||
|
};
|
||||||
|
|
||||||
MouseEventHandler::<Self>::new(0, cx, |state, cx| {
|
MouseEventHandler::<Self>::new(0, cx, |state, cx| {
|
||||||
let theme = &cx.global::<Settings>().theme.workspace.status_bar;
|
let theme = &cx.global::<Settings>().theme.workspace.status_bar;
|
||||||
let style = theme.active_language.style_for(state, false);
|
let style = theme.active_language.style_for(state, false);
|
||||||
Label::new(active_language, style.text.clone())
|
Label::new(active_language_text, style.text.clone())
|
||||||
.contained()
|
.contained()
|
||||||
.with_style(style.container)
|
.with_style(style.container)
|
||||||
.boxed()
|
.boxed()
|
||||||
})
|
})
|
||||||
.with_cursor_style(CursorStyle::PointingHand)
|
.with_cursor_style(CursorStyle::PointingHand)
|
||||||
.on_click(MouseButton::Left, |_, cx| cx.dispatch_action(crate::Toggle))
|
.on_click(MouseButton::Left, |_, cx| cx.dispatch_action(crate::Toggle))
|
||||||
.boxed()
|
.boxed()
|
||||||
|
} else {
|
||||||
|
Empty::new().boxed()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,11 +43,12 @@ impl Project {
|
||||||
.push(terminal_handle.downgrade());
|
.push(terminal_handle.downgrade());
|
||||||
|
|
||||||
let id = terminal_handle.id();
|
let id = terminal_handle.id();
|
||||||
cx.observe_release(&terminal_handle, move |project, _terminal, _cx| {
|
cx.observe_release(&terminal_handle, move |project, _terminal, cx| {
|
||||||
let handles = &mut project.terminals.local_handles;
|
let handles = &mut project.terminals.local_handles;
|
||||||
|
|
||||||
if let Some(index) = handles.iter().position(|terminal| terminal.id() == id) {
|
if let Some(index) = handles.iter().position(|terminal| terminal.id() == id) {
|
||||||
handles.remove(index);
|
handles.remove(index);
|
||||||
|
cx.notify();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|
|
@ -19,7 +19,6 @@ pub struct FocusTerminal {
|
||||||
terminal_handle: WeakModelHandle<Terminal>,
|
terminal_handle: WeakModelHandle<Terminal>,
|
||||||
}
|
}
|
||||||
|
|
||||||
//actions!(terminal, [DeployTerminalMenu]);
|
|
||||||
impl_internal_actions!(terminal, [FocusTerminal, DeployTerminalMenu]);
|
impl_internal_actions!(terminal, [FocusTerminal, DeployTerminalMenu]);
|
||||||
|
|
||||||
pub fn init(cx: &mut MutableAppContext) {
|
pub fn init(cx: &mut MutableAppContext) {
|
||||||
|
@ -56,13 +55,14 @@ impl View for TerminalButton {
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
|
|
||||||
let has_terminals = !project.local_terminal_handles().is_empty();
|
let has_terminals = !project.local_terminal_handles().is_empty();
|
||||||
|
let terminal_count = project.local_terminal_handles().len() as i32;
|
||||||
let theme = cx.global::<Settings>().theme.clone();
|
let theme = cx.global::<Settings>().theme.clone();
|
||||||
|
|
||||||
Stack::new()
|
Stack::new()
|
||||||
.with_child(
|
.with_child(
|
||||||
MouseEventHandler::<Self>::new(0, cx, {
|
MouseEventHandler::<Self>::new(0, cx, {
|
||||||
let theme = theme.clone();
|
let theme = theme.clone();
|
||||||
move |state, _| {
|
move |state, _cx| {
|
||||||
let style = theme
|
let style = theme
|
||||||
.workspace
|
.workspace
|
||||||
.status_bar
|
.status_bar
|
||||||
|
@ -70,10 +70,23 @@ impl View for TerminalButton {
|
||||||
.item
|
.item
|
||||||
.style_for(state, active);
|
.style_for(state, active);
|
||||||
|
|
||||||
Svg::new("icons/terminal_12.svg")
|
Flex::row()
|
||||||
.with_color(style.icon_color)
|
.with_child(
|
||||||
|
Svg::new("icons/terminal_12.svg")
|
||||||
|
.with_color(style.icon_color)
|
||||||
|
.constrained()
|
||||||
|
.with_width(style.icon_size)
|
||||||
|
.aligned()
|
||||||
|
.named("terminals-icon"),
|
||||||
|
)
|
||||||
|
.with_children(has_terminals.then(|| {
|
||||||
|
Label::new(terminal_count.to_string(), style.label.text.clone())
|
||||||
|
.contained()
|
||||||
|
.with_style(style.label.container)
|
||||||
|
.aligned()
|
||||||
|
.boxed()
|
||||||
|
}))
|
||||||
.constrained()
|
.constrained()
|
||||||
.with_width(style.icon_size)
|
|
||||||
.with_height(style.icon_size)
|
.with_height(style.icon_size)
|
||||||
.contained()
|
.contained()
|
||||||
.with_style(style.container)
|
.with_style(style.container)
|
||||||
|
@ -112,8 +125,7 @@ impl View for TerminalButton {
|
||||||
|
|
||||||
impl TerminalButton {
|
impl TerminalButton {
|
||||||
pub fn new(workspace: ViewHandle<Workspace>, cx: &mut ViewContext<Self>) -> Self {
|
pub fn new(workspace: ViewHandle<Workspace>, cx: &mut ViewContext<Self>) -> Self {
|
||||||
// When terminal moves, redraw so that the icon and toggle status matches.
|
cx.observe(&workspace, |_, _, cx| cx.notify()).detach();
|
||||||
cx.subscribe(&workspace, |_, _, _, cx| cx.notify()).detach();
|
|
||||||
Self {
|
Self {
|
||||||
workspace: workspace.downgrade(),
|
workspace: workspace.downgrade(),
|
||||||
popup_menu: cx.add_view(|cx| {
|
popup_menu: cx.add_view(|cx| {
|
||||||
|
|
|
@ -340,12 +340,13 @@ pub struct Sidebar {
|
||||||
pub container: ContainerStyle,
|
pub container: ContainerStyle,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Deserialize, Default)]
|
#[derive(Clone, Deserialize, Default)]
|
||||||
pub struct SidebarItem {
|
pub struct SidebarItem {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub container: ContainerStyle,
|
pub container: ContainerStyle,
|
||||||
pub icon_color: Color,
|
pub icon_color: Color,
|
||||||
pub icon_size: f32,
|
pub icon_size: f32,
|
||||||
|
pub label: ContainedText,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Default)]
|
#[derive(Deserialize, Default)]
|
||||||
|
|
|
@ -230,7 +230,7 @@ impl View for SidebarButtons {
|
||||||
let tooltip_style = theme.tooltip.clone();
|
let tooltip_style = theme.tooltip.clone();
|
||||||
let theme = &theme.workspace.status_bar.sidebar_buttons;
|
let theme = &theme.workspace.status_bar.sidebar_buttons;
|
||||||
let sidebar = self.sidebar.read(cx);
|
let sidebar = self.sidebar.read(cx);
|
||||||
let item_style = theme.item;
|
let item_style = theme.item.clone();
|
||||||
let badge_style = theme.badge;
|
let badge_style = theme.badge;
|
||||||
let active_ix = sidebar.active_item_ix;
|
let active_ix = sidebar.active_item_ix;
|
||||||
let is_open = sidebar.is_open;
|
let is_open = sidebar.is_open;
|
||||||
|
@ -254,7 +254,7 @@ impl View for SidebarButtons {
|
||||||
sidebar_side,
|
sidebar_side,
|
||||||
item_index: ix,
|
item_index: ix,
|
||||||
};
|
};
|
||||||
MouseEventHandler::<Self>::new(ix, cx, move |state, cx| {
|
MouseEventHandler::<Self>::new(ix, cx, |state, cx| {
|
||||||
let is_active = is_open && ix == active_ix;
|
let is_active = is_open && ix == active_ix;
|
||||||
let style = item_style.style_for(state, is_active);
|
let style = item_style.style_for(state, is_active);
|
||||||
Stack::new()
|
Stack::new()
|
||||||
|
|
|
@ -3,7 +3,7 @@ authors = ["Nathan Sobo <nathansobo@gmail.com>"]
|
||||||
description = "The fast, collaborative code editor."
|
description = "The fast, collaborative code editor."
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "zed"
|
name = "zed"
|
||||||
version = "0.79.0"
|
version = "0.80.0"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -64,7 +64,6 @@ pub async fn npm_install_packages(
|
||||||
let output = smol::process::Command::new("npm")
|
let output = smol::process::Command::new("npm")
|
||||||
.args(["-fetch-retry-mintimeout", "2000"])
|
.args(["-fetch-retry-mintimeout", "2000"])
|
||||||
.args(["-fetch-retry-maxtimeout", "5000"])
|
.args(["-fetch-retry-maxtimeout", "5000"])
|
||||||
.args(["-fetch-timeout", "5000"])
|
|
||||||
.arg("install")
|
.arg("install")
|
||||||
.arg("--prefix")
|
.arg("--prefix")
|
||||||
.arg(directory)
|
.arg(directory)
|
||||||
|
|
|
@ -100,6 +100,10 @@ export default function statusBar(colorScheme: ColorScheme) {
|
||||||
...statusContainer,
|
...statusContainer,
|
||||||
iconSize: 16,
|
iconSize: 16,
|
||||||
iconColor: foreground(layer, "variant"),
|
iconColor: foreground(layer, "variant"),
|
||||||
|
label: {
|
||||||
|
margin: { left: 6 },
|
||||||
|
...text(layer, "sans", { size: "sm" }),
|
||||||
|
},
|
||||||
hover: {
|
hover: {
|
||||||
iconColor: foreground(layer, "hovered"),
|
iconColor: foreground(layer, "hovered"),
|
||||||
background: background(layer, "variant"),
|
background: background(layer, "variant"),
|
||||||
|
|
|
@ -174,6 +174,9 @@ export default function workspace(colorScheme: ColorScheme) {
|
||||||
// Sign in buttom
|
// Sign in buttom
|
||||||
// FlatButton, Variant
|
// FlatButton, Variant
|
||||||
signInPrompt: {
|
signInPrompt: {
|
||||||
|
margin: {
|
||||||
|
left: itemSpacing
|
||||||
|
},
|
||||||
...titlebarButton,
|
...titlebarButton,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue