Add additional status colors and style diagnostic popovers (#3846)
This PR adds additional background and border colors for each of the status colors to the theme. These colors are then used to style the diagnostic popovers: <img width="407" alt="Screenshot 2024-01-02 at 4 25 50 PM" src="https://github.com/zed-industries/zed/assets/1486634/fbc64ea7-3dcd-43b7-8520-91f16304bfba"> <img width="396" alt="Screenshot 2024-01-02 at 4 26 05 PM" src="https://github.com/zed-industries/zed/assets/1486634/6e4a44bf-4aac-4595-afff-7fbf8b2b9e1f"> Release Notes: - N/A
This commit is contained in:
@@ -97,7 +97,7 @@ use std::{
|
||||
pub use sum_tree::Bias;
|
||||
use sum_tree::TreeMap;
|
||||
use text::{OffsetUtf16, Rope};
|
||||
use theme::{ActiveTheme, DiagnosticStyle, PlayerColor, SyntaxTheme, ThemeColors, ThemeSettings};
|
||||
use theme::{ActiveTheme, PlayerColor, StatusColors, SyntaxTheme, ThemeColors, ThemeSettings};
|
||||
use ui::{h_stack, ButtonSize, ButtonStyle, Icon, IconButton, Popover, Tooltip};
|
||||
use ui::{prelude::*, IconSize};
|
||||
use util::{post_inc, RangeExt, ResultExt, TryFutureExt};
|
||||
@@ -512,7 +512,7 @@ pub struct EditorStyle {
|
||||
pub text: TextStyle,
|
||||
pub scrollbar_width: Pixels,
|
||||
pub syntax: Arc<SyntaxTheme>,
|
||||
pub diagnostic_style: DiagnosticStyle,
|
||||
pub status: StatusColors,
|
||||
pub inlays_style: HighlightStyle,
|
||||
pub suggestions_style: HighlightStyle,
|
||||
}
|
||||
@@ -7662,10 +7662,7 @@ impl Editor {
|
||||
text: text_style,
|
||||
scrollbar_width: cx.editor_style.scrollbar_width,
|
||||
syntax: cx.editor_style.syntax.clone(),
|
||||
diagnostic_style: cx
|
||||
.editor_style
|
||||
.diagnostic_style
|
||||
.clone(),
|
||||
status: cx.editor_style.status.clone(),
|
||||
// todo!("what about the rest of the highlight style parts for inlays and suggestions?")
|
||||
inlays_style: HighlightStyle {
|
||||
color: Some(cx.theme().status().hint),
|
||||
@@ -9335,7 +9332,7 @@ impl Render for Editor {
|
||||
text: text_style,
|
||||
scrollbar_width: px(12.),
|
||||
syntax: cx.theme().syntax().clone(),
|
||||
diagnostic_style: cx.theme().diagnostic_style(),
|
||||
status: cx.theme().status().clone(),
|
||||
// todo!("what about the rest of the highlight style parts?")
|
||||
inlays_style: HighlightStyle {
|
||||
color: Some(cx.theme().status().hint),
|
||||
@@ -9789,21 +9786,17 @@ pub fn highlight_diagnostic_message(diagnostic: &Diagnostic) -> (SharedString, V
|
||||
(text_without_backticks.into(), code_ranges)
|
||||
}
|
||||
|
||||
pub fn diagnostic_style(
|
||||
severity: DiagnosticSeverity,
|
||||
valid: bool,
|
||||
style: &DiagnosticStyle,
|
||||
) -> Hsla {
|
||||
pub fn diagnostic_style(severity: DiagnosticSeverity, valid: bool, colors: &StatusColors) -> Hsla {
|
||||
match (severity, valid) {
|
||||
(DiagnosticSeverity::ERROR, true) => style.error,
|
||||
(DiagnosticSeverity::ERROR, false) => style.error,
|
||||
(DiagnosticSeverity::WARNING, true) => style.warning,
|
||||
(DiagnosticSeverity::WARNING, false) => style.warning,
|
||||
(DiagnosticSeverity::INFORMATION, true) => style.info,
|
||||
(DiagnosticSeverity::INFORMATION, false) => style.info,
|
||||
(DiagnosticSeverity::HINT, true) => style.info,
|
||||
(DiagnosticSeverity::HINT, false) => style.info,
|
||||
_ => style.ignored,
|
||||
(DiagnosticSeverity::ERROR, true) => colors.error,
|
||||
(DiagnosticSeverity::ERROR, false) => colors.error,
|
||||
(DiagnosticSeverity::WARNING, true) => colors.warning,
|
||||
(DiagnosticSeverity::WARNING, false) => colors.warning,
|
||||
(DiagnosticSeverity::INFORMATION, true) => colors.info,
|
||||
(DiagnosticSeverity::INFORMATION, false) => colors.info,
|
||||
(DiagnosticSeverity::HINT, true) => colors.info,
|
||||
(DiagnosticSeverity::HINT, false) => colors.info,
|
||||
_ => colors.ignored,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user