From 0efbe6eb342a1f3811433e26ddd8b21aefb587c9 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Wed, 31 Aug 2022 20:35:42 -0700 Subject: [PATCH 1/2] Made code actions themeable --- styles/package-lock.json | 1 - styles/src/styleTree/editor.ts | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/styles/package-lock.json b/styles/package-lock.json index 582f1c8496..5499f1852c 100644 --- a/styles/package-lock.json +++ b/styles/package-lock.json @@ -5,7 +5,6 @@ "requires": true, "packages": { "": { - "name": "styles", "version": "1.0.0", "license": "ISC", "dependencies": { diff --git a/styles/src/styleTree/editor.ts b/styles/src/styleTree/editor.ts index e3c1844974..62f7a0efdf 100644 --- a/styles/src/styleTree/editor.ts +++ b/styles/src/styleTree/editor.ts @@ -55,7 +55,10 @@ export default function editor(theme: Theme) { textColor: theme.syntax.primary.color, background: backgroundColor(theme, 500), activeLineBackground: theme.editor.line.active, - codeActionsIndicator: iconColor(theme, "secondary"), + codeActions: { + indicator: iconColor(theme, "secondary"), + verticalScale: 0.618 + }, diffBackgroundDeleted: backgroundColor(theme, "error"), diffBackgroundInserted: backgroundColor(theme, "ok"), documentHighlightReadBackground: theme.editor.highlight.occurrence, From 1a0f43f0c58a16898467f1b3f3f7ec6e55e9ae3f Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Wed, 31 Aug 2022 20:37:04 -0700 Subject: [PATCH 2/2] Actually added all files this time --- crates/editor/src/editor.rs | 2 +- crates/editor/src/element.rs | 5 ++++- crates/theme/src/theme.rs | 9 ++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 9e5a6329bf..ce31e68dae 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -2737,7 +2737,7 @@ impl Editor { Some( MouseEventHandler::new::(0, cx, |_, _| { Svg::new("icons/bolt_8.svg") - .with_color(style.code_actions_indicator) + .with_color(style.code_actions.indicator) .boxed() }) .with_cursor_style(CursorStyle::PointingHand) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index f6cc2796b1..d9d0c3990c 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -1453,7 +1453,10 @@ impl Element for EditorElement { if let Some((_, indicator)) = code_actions_indicator.as_mut() { indicator.layout( - SizeConstraint::strict_along(Axis::Vertical, line_height * 0.618), + SizeConstraint::strict_along( + Axis::Vertical, + line_height * style.code_actions.vertical_scale, + ), cx, ); } diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index be89148985..ff13a23314 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -480,7 +480,7 @@ pub struct Editor { pub hint_diagnostic: DiagnosticStyle, pub invalid_hint_diagnostic: DiagnosticStyle, pub autocomplete: AutocompleteStyle, - pub code_actions_indicator: Color, + pub code_actions: CodeActions, pub unnecessary_code_fade: f32, pub hover_popover: HoverPopover, pub link_definition: HighlightStyle, @@ -541,6 +541,13 @@ pub struct FieldEditor { pub selection: SelectionStyle, } +#[derive(Clone, Deserialize, Default)] +pub struct CodeActions { + #[serde(default)] + pub indicator: Color, + pub vertical_scale: f32, +} + #[derive(Debug, Default, Clone, Copy)] pub struct Interactive { pub default: T,