Merge pull request #1589 from zed-industries/add-code-action-size

Add code action size
This commit is contained in:
Mikayla Maki 2022-08-31 20:38:31 -07:00 committed by GitHub
commit bf6d3ad02d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 5 deletions

View file

@ -2737,7 +2737,7 @@ impl Editor {
Some( Some(
MouseEventHandler::new::<Tag, _, _>(0, cx, |_, _| { MouseEventHandler::new::<Tag, _, _>(0, cx, |_, _| {
Svg::new("icons/bolt_8.svg") Svg::new("icons/bolt_8.svg")
.with_color(style.code_actions_indicator) .with_color(style.code_actions.indicator)
.boxed() .boxed()
}) })
.with_cursor_style(CursorStyle::PointingHand) .with_cursor_style(CursorStyle::PointingHand)

View file

@ -1453,7 +1453,10 @@ impl Element for EditorElement {
if let Some((_, indicator)) = code_actions_indicator.as_mut() { if let Some((_, indicator)) = code_actions_indicator.as_mut() {
indicator.layout( indicator.layout(
SizeConstraint::strict_along(Axis::Vertical, line_height * 0.618), SizeConstraint::strict_along(
Axis::Vertical,
line_height * style.code_actions.vertical_scale,
),
cx, cx,
); );
} }

View file

@ -480,7 +480,7 @@ pub struct Editor {
pub hint_diagnostic: DiagnosticStyle, pub hint_diagnostic: DiagnosticStyle,
pub invalid_hint_diagnostic: DiagnosticStyle, pub invalid_hint_diagnostic: DiagnosticStyle,
pub autocomplete: AutocompleteStyle, pub autocomplete: AutocompleteStyle,
pub code_actions_indicator: Color, pub code_actions: CodeActions,
pub unnecessary_code_fade: f32, pub unnecessary_code_fade: f32,
pub hover_popover: HoverPopover, pub hover_popover: HoverPopover,
pub link_definition: HighlightStyle, pub link_definition: HighlightStyle,
@ -541,6 +541,13 @@ pub struct FieldEditor {
pub selection: SelectionStyle, pub selection: SelectionStyle,
} }
#[derive(Clone, Deserialize, Default)]
pub struct CodeActions {
#[serde(default)]
pub indicator: Color,
pub vertical_scale: f32,
}
#[derive(Debug, Default, Clone, Copy)] #[derive(Debug, Default, Clone, Copy)]
pub struct Interactive<T> { pub struct Interactive<T> {
pub default: T, pub default: T,

View file

@ -5,7 +5,6 @@
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "styles",
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {

View file

@ -55,7 +55,10 @@ export default function editor(theme: Theme) {
textColor: theme.syntax.primary.color, textColor: theme.syntax.primary.color,
background: backgroundColor(theme, 500), background: backgroundColor(theme, 500),
activeLineBackground: theme.editor.line.active, activeLineBackground: theme.editor.line.active,
codeActionsIndicator: iconColor(theme, "secondary"), codeActions: {
indicator: iconColor(theme, "secondary"),
verticalScale: 0.618
},
diffBackgroundDeleted: backgroundColor(theme, "error"), diffBackgroundDeleted: backgroundColor(theme, "error"),
diffBackgroundInserted: backgroundColor(theme, "ok"), diffBackgroundInserted: backgroundColor(theme, "ok"),
documentHighlightReadBackground: theme.editor.highlight.occurrence, documentHighlightReadBackground: theme.editor.highlight.occurrence,