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.

Use defaults for unchanged `TextStyle` fields (#14918)

Marshall Bowerscb2c33435871
diff --git a/crates/assistant/src/inline_assistant.rs b/crates/assistant/src/inline_assistant.rs
index b8dbcacd2b4..69d3349fa1b 100644
--- a/crates/assistant/src/inline_assistant.rs
+++ b/crates/assistant/src/inline_assistant.rs
@@ -22,9 +22,9 @@ use futures::{
SinkExt, Stream, StreamExt,
};
use gpui::{
- point, AppContext, EventEmitter, FocusHandle, FocusableView, FontStyle, Global, HighlightStyle,
- Model, ModelContext, Subscription, Task, TextStyle, UpdateGlobal, View, ViewContext, WeakView,
- WhiteSpace, WindowContext,
+ point, AppContext, EventEmitter, FocusHandle, FocusableView, Global, HighlightStyle, Model,
+ ModelContext, Subscription, Task, TextStyle, UpdateGlobal, View, ViewContext, WeakView,
+ WindowContext,
};
use language::{Buffer, Point, Selection, TransactionId};
use language_model::{LanguageModelRequest, LanguageModelRequestMessage, Role};
@@ -1864,12 +1864,8 @@ impl PromptEditor {
font_features: settings.ui_font.features.clone(),
font_size: rems(0.875).into(),
font_weight: settings.ui_font.weight,
- font_style: FontStyle::Normal,
line_height: relative(1.3),
- background_color: None,
- underline: None,
- strikethrough: None,
- white_space: WhiteSpace::Normal,
+ ..Default::default()
};
EditorElement::new(
&self.editor,
diff --git a/crates/assistant/src/terminal_inline_assistant.rs b/crates/assistant/src/terminal_inline_assistant.rs
index 192db0cf5e1..77a6a9e53fb 100644
--- a/crates/assistant/src/terminal_inline_assistant.rs
+++ b/crates/assistant/src/terminal_inline_assistant.rs
@@ -13,8 +13,8 @@ use editor::{
use fs::Fs;
use futures::{channel::mpsc, SinkExt, StreamExt};
use gpui::{
- AppContext, Context, EventEmitter, FocusHandle, FocusableView, FontStyle, FontWeight, Global,
- Model, ModelContext, Subscription, Task, TextStyle, UpdateGlobal, View, WeakView, WhiteSpace,
+ AppContext, Context, EventEmitter, FocusHandle, FocusableView, FontWeight, Global, Model,
+ ModelContext, Subscription, Task, TextStyle, UpdateGlobal, View, WeakView,
};
use language::Buffer;
use language_model::{LanguageModelRequest, LanguageModelRequestMessage, Role};
@@ -946,12 +946,8 @@ impl PromptEditor {
font_features: settings.ui_font.features.clone(),
font_size: rems(0.875).into(),
font_weight: FontWeight::NORMAL,
- font_style: FontStyle::Normal,
line_height: relative(1.3),
- background_color: None,
- underline: None,
- strikethrough: None,
- white_space: WhiteSpace::Normal,
+ ..Default::default()
};
EditorElement::new(
&self.editor,
diff --git a/crates/collab_ui/src/chat_panel/message_editor.rs b/crates/collab_ui/src/chat_panel/message_editor.rs
index 91491536760..fb558e2ddaf 100644
--- a/crates/collab_ui/src/chat_panel/message_editor.rs
+++ b/crates/collab_ui/src/chat_panel/message_editor.rs
@@ -6,7 +6,7 @@ use editor::{AnchorRangeExt, CompletionProvider, Editor, EditorElement, EditorSt
use fuzzy::{StringMatch, StringMatchCandidate};
use gpui::{
AsyncWindowContext, FocusableView, FontStyle, FontWeight, HighlightStyle, IntoElement, Model,
- Render, Task, TextStyle, View, ViewContext, WeakView, WhiteSpace,
+ Render, Task, TextStyle, View, ViewContext, WeakView,
};
use language::{
language_settings::SoftWrap, Anchor, Buffer, BufferSnapshot, CodeLabel, LanguageRegistry,
@@ -537,10 +537,7 @@ impl Render for MessageEditor {
font_weight: settings.ui_font.weight,
font_style: FontStyle::Normal,
line_height: relative(1.3),
- background_color: None,
- underline: None,
- strikethrough: None,
- white_space: WhiteSpace::Normal,
+ ..Default::default()
};
div()
diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rs
index e4f03b14f24..e1458cbadf8 100644
--- a/crates/collab_ui/src/collab_panel.rs
+++ b/crates/collab_ui/src/collab_panel.rs
@@ -16,7 +16,7 @@ use gpui::{
EventEmitter, FocusHandle, FocusableView, FontStyle, InteractiveElement, IntoElement,
ListOffset, ListState, Model, MouseDownEvent, ParentElement, Pixels, Point, PromptLevel,
Render, SharedString, Styled, Subscription, Task, TextStyle, View, ViewContext, VisualContext,
- WeakView, WhiteSpace,
+ WeakView,
};
use menu::{Cancel, Confirm, SecondaryConfirm, SelectNext, SelectPrev};
use project::{Fs, Project};
@@ -2194,10 +2194,7 @@ impl CollabPanel {
font_weight: settings.ui_font.weight,
font_style: FontStyle::Normal,
line_height: relative(1.3),
- background_color: None,
- underline: None,
- strikethrough: None,
- white_space: WhiteSpace::Normal,
+ ..Default::default()
};
EditorElement::new(
diff --git a/crates/completion/src/anthropic.rs b/crates/completion/src/anthropic.rs
index dc71ebd8ca4..b1bbe8a35be 100644
--- a/crates/completion/src/anthropic.rs
+++ b/crates/completion/src/anthropic.rs
@@ -4,7 +4,7 @@ use anthropic::{stream_completion, Model as AnthropicModel, Request, RequestMess
use anyhow::{anyhow, Result};
use editor::{Editor, EditorElement, EditorStyle};
use futures::{future::BoxFuture, stream::BoxStream, FutureExt, StreamExt};
-use gpui::{AnyView, AppContext, FontStyle, Task, TextStyle, View, WhiteSpace};
+use gpui::{AnyView, AppContext, Task, TextStyle, View};
use http::HttpClient;
use language_model::Role;
use settings::Settings;
@@ -257,12 +257,8 @@ impl AuthenticationPrompt {
font_features: settings.ui_font.features.clone(),
font_size: rems(0.875).into(),
font_weight: settings.ui_font.weight,
- font_style: FontStyle::Normal,
line_height: relative(1.3),
- background_color: None,
- underline: None,
- strikethrough: None,
- white_space: WhiteSpace::Normal,
+ ..Default::default()
};
EditorElement::new(
&self.api_key,
diff --git a/crates/completion/src/open_ai.rs b/crates/completion/src/open_ai.rs
index 0a0f6d5b4a3..d187842bcbe 100644
--- a/crates/completion/src/open_ai.rs
+++ b/crates/completion/src/open_ai.rs
@@ -3,7 +3,7 @@ use crate::LanguageModelCompletionProvider;
use anyhow::{anyhow, Result};
use editor::{Editor, EditorElement, EditorStyle};
use futures::{future::BoxFuture, stream::BoxStream, FutureExt, StreamExt};
-use gpui::{AnyView, AppContext, FontStyle, Task, TextStyle, View, WhiteSpace};
+use gpui::{AnyView, AppContext, Task, TextStyle, View};
use http::HttpClient;
use language_model::{CloudModel, LanguageModel, LanguageModelRequest, Role};
use open_ai::Model as OpenAiModel;
@@ -298,12 +298,8 @@ impl AuthenticationPrompt {
font_features: settings.ui_font.features.clone(),
font_size: rems(0.875).into(),
font_weight: settings.ui_font.weight,
- font_style: FontStyle::Normal,
line_height: relative(1.3),
- background_color: None,
- underline: None,
- strikethrough: None,
- white_space: WhiteSpace::Normal,
+ ..Default::default()
};
EditorElement::new(
&self.api_key,
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index cf4b8e0d516..14b1f14df69 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -69,11 +69,11 @@ use gpui::{
div, impl_actions, point, prelude::*, px, relative, size, uniform_list, Action, AnyElement,
AppContext, AsyncWindowContext, AvailableSpace, BackgroundExecutor, Bounds, ClipboardItem,
Context, DispatchPhase, ElementId, EntityId, EventEmitter, FocusHandle, FocusOutEvent,
- FocusableView, FontId, FontStyle, FontWeight, HighlightStyle, Hsla, InteractiveText,
- KeyContext, ListSizingBehavior, Model, MouseButton, PaintQuad, ParentElement, Pixels, Render,
- SharedString, Size, StrikethroughStyle, Styled, StyledText, Subscription, Task, TextStyle,
- UnderlineStyle, UniformListScrollHandle, View, ViewContext, ViewInputHandler, VisualContext,
- WeakFocusHandle, WeakView, WhiteSpace, WindowContext,
+ FocusableView, FontId, FontWeight, HighlightStyle, Hsla, InteractiveText, KeyContext,
+ ListSizingBehavior, Model, MouseButton, PaintQuad, ParentElement, Pixels, Render, SharedString,
+ Size, StrikethroughStyle, Styled, StyledText, Subscription, Task, TextStyle, UnderlineStyle,
+ UniformListScrollHandle, View, ViewContext, ViewInputHandler, VisualContext, WeakFocusHandle,
+ WeakView, WindowContext,
};
use highlight_matching_bracket::refresh_matching_bracket_highlights;
use hover_popover::{hide_hover, HoverState};
@@ -12438,12 +12438,8 @@ impl Render for Editor {
font_features: settings.ui_font.features.clone(),
font_size: rems(0.875).into(),
font_weight: settings.ui_font.weight,
- font_style: FontStyle::Normal,
line_height: relative(settings.buffer_line_height.value()),
- background_color: None,
- underline: None,
- strikethrough: None,
- white_space: WhiteSpace::Normal,
+ ..Default::default()
},
EditorMode::Full => TextStyle {
color: cx.theme().colors().editor_foreground,
@@ -12451,12 +12447,8 @@ impl Render for Editor {
font_features: settings.buffer_font.features.clone(),
font_size: settings.buffer_font_size(cx).into(),
font_weight: settings.buffer_font.weight,
- font_style: FontStyle::Normal,
line_height: relative(settings.buffer_line_height.value()),
- background_color: None,
- underline: None,
- strikethrough: None,
- white_space: WhiteSpace::Normal,
+ ..Default::default()
},
};
diff --git a/crates/extensions_ui/src/extensions_ui.rs b/crates/extensions_ui/src/extensions_ui.rs
index b04d0fb84e9..e39bd18c7cd 100644
--- a/crates/extensions_ui/src/extensions_ui.rs
+++ b/crates/extensions_ui/src/extensions_ui.rs
@@ -14,9 +14,9 @@ use editor::{Editor, EditorElement, EditorStyle};
use extension::{ExtensionManifest, ExtensionOperation, ExtensionStore};
use fuzzy::{match_strings, StringMatchCandidate};
use gpui::{
- actions, uniform_list, AppContext, EventEmitter, Flatten, FocusableView, FontStyle,
- InteractiveElement, KeyContext, ParentElement, Render, Styled, Task, TextStyle,
- UniformListScrollHandle, View, ViewContext, VisualContext, WeakView, WhiteSpace, WindowContext,
+ actions, uniform_list, AppContext, EventEmitter, Flatten, FocusableView, InteractiveElement,
+ KeyContext, ParentElement, Render, Styled, Task, TextStyle, UniformListScrollHandle, View,
+ ViewContext, VisualContext, WeakView, WindowContext,
};
use num_format::{Locale, ToFormattedString};
use project::DirectoryLister;
@@ -804,12 +804,8 @@ impl ExtensionsPage {
font_features: settings.ui_font.features.clone(),
font_size: rems(0.875).into(),
font_weight: settings.ui_font.weight,
- font_style: FontStyle::Normal,
line_height: relative(1.3),
- background_color: None,
- underline: None,
- strikethrough: None,
- white_space: WhiteSpace::Normal,
+ ..Default::default()
};
EditorElement::new(
diff --git a/crates/language/src/outline.rs b/crates/language/src/outline.rs
index af7f97fe982..31e1b9abc62 100644
--- a/crates/language/src/outline.rs
+++ b/crates/language/src/outline.rs
@@ -1,8 +1,5 @@
use fuzzy::{StringMatch, StringMatchCandidate};
-use gpui::{
- relative, AppContext, BackgroundExecutor, FontStyle, HighlightStyle, StyledText, TextStyle,
- WhiteSpace,
-};
+use gpui::{relative, AppContext, BackgroundExecutor, HighlightStyle, StyledText, TextStyle};
use settings::Settings;
use std::ops::Range;
use theme::{color_alpha, ActiveTheme, ThemeSettings};
@@ -167,12 +164,8 @@ pub fn render_item<T>(
font_features: settings.buffer_font.features.clone(),
font_size: settings.buffer_font_size(cx).into(),
font_weight: settings.buffer_font.weight,
- font_style: FontStyle::Normal,
line_height: relative(1.),
- background_color: None,
- underline: None,
- strikethrough: None,
- white_space: WhiteSpace::Normal,
+ ..Default::default()
};
let highlights = gpui::combine_highlights(
custom_highlights,
diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs
index d0669b4cfca..51e58e5d015 100644
--- a/crates/search/src/buffer_search.rs
+++ b/crates/search/src/buffer_search.rs
@@ -13,10 +13,9 @@ use editor::{
};
use futures::channel::oneshot;
use gpui::{
- actions, div, impl_actions, Action, AppContext, ClickEvent, EventEmitter, FocusableView,
- FontStyle, Hsla, InteractiveElement as _, IntoElement, KeyContext, ParentElement as _, Render,
- ScrollHandle, Styled, Subscription, Task, TextStyle, View, ViewContext, VisualContext as _,
- WhiteSpace, WindowContext,
+ actions, div, impl_actions, Action, AppContext, ClickEvent, EventEmitter, FocusableView, Hsla,
+ InteractiveElement as _, IntoElement, KeyContext, ParentElement as _, Render, ScrollHandle,
+ Styled, Subscription, Task, TextStyle, View, ViewContext, VisualContext as _, WindowContext,
};
use project::{
search::SearchQuery,
@@ -117,12 +116,8 @@ impl BufferSearchBar {
font_features: settings.buffer_font.features.clone(),
font_size: rems(0.875).into(),
font_weight: settings.buffer_font.weight,
- font_style: FontStyle::Normal,
line_height: relative(1.3),
- background_color: None,
- underline: None,
- strikethrough: None,
- white_space: WhiteSpace::Normal,
+ ..Default::default()
};
EditorElement::new(
diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs
index e3b6d51610c..0014b203040 100644
--- a/crates/search/src/project_search.rs
+++ b/crates/search/src/project_search.rs
@@ -13,10 +13,9 @@ use editor::{
};
use gpui::{
actions, div, Action, AnyElement, AnyView, AppContext, Context as _, EntityId, EventEmitter,
- FocusHandle, FocusableView, FontStyle, Global, Hsla, InteractiveElement, IntoElement,
- KeyContext, Model, ModelContext, ParentElement, Point, Render, SharedString, Styled,
- Subscription, Task, TextStyle, UpdateGlobal, View, ViewContext, VisualContext, WeakModel,
- WhiteSpace, WindowContext,
+ FocusHandle, FocusableView, Global, Hsla, InteractiveElement, IntoElement, KeyContext, Model,
+ ModelContext, ParentElement, Point, Render, SharedString, Styled, Subscription, Task,
+ TextStyle, UpdateGlobal, View, ViewContext, VisualContext, WeakModel, WindowContext,
};
use menu::Confirm;
use project::{search::SearchQuery, search_history::SearchHistoryCursor, Project, ProjectPath};
@@ -1341,12 +1340,8 @@ impl ProjectSearchBar {
font_features: settings.buffer_font.features.clone(),
font_size: rems(0.875).into(),
font_weight: settings.buffer_font.weight,
- font_style: FontStyle::Normal,
line_height: relative(1.3),
- background_color: None,
- underline: None,
- strikethrough: None,
- white_space: WhiteSpace::Normal,
+ ..Default::default()
};
EditorElement::new(