Merge branch 'main' into refine-render-traits

This commit is contained in:
Piotr Osiewicz
2024-01-03 12:27:42 +01:00
97 changed files with 3995 additions and 1527 deletions
+14 -24
View File
@@ -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,
}
@@ -1195,7 +1195,6 @@ impl CompletionsMenu {
.min_w(px(260.))
.max_w(px(640.))
.w(px(500.))
.text_ui()
.overflow_y_scroll()
// Prevent a mouse down on documentation from being propagated to the editor,
// because that would move the cursor.
@@ -1251,7 +1250,6 @@ impl CompletionsMenu {
.max_w(px(540.))
.whitespace_nowrap()
.overflow_hidden()
.text_ui()
.px_1()
.rounded(px(4.))
.bg(cx.theme().colors().ghost_element_background)
@@ -1425,7 +1423,6 @@ impl CodeActionsMenu {
let colors = cx.theme().colors();
div()
.px_2()
.text_ui()
.text_color(colors.text)
.when(selected, |style| {
style
@@ -7662,10 +7659,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 +9329,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 +9783,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,
}
}