From 56296d79c7eba0a17a403de9a231bcd0ec1461d9 Mon Sep 17 00:00:00 2001 From: Dongdong Zhou Date: Fri, 30 Jul 2021 18:05:33 +0100 Subject: [PATCH] code actions light bulb --- core/src/editor.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/src/editor.rs b/core/src/editor.rs index 1c37addd..c8e4a6c4 100644 --- a/core/src/editor.rs +++ b/core/src/editor.rs @@ -834,7 +834,7 @@ fn paint_code_actions_hint( let width = 14.0; let height = 14.0; let rect = Size::new(width, height).to_rect().with_origin(Point::new( - (line_height - width) / 2.0 + 5.0 + data.editor.scroll_offset.x, + data.editor.scroll_offset.x, (line_height - height) / 2.0 + line_height * line as f64, )); svg.paint(ctx, rect, None); @@ -1320,6 +1320,17 @@ fn update( ctx.request_paint_rect(rect); } + if old_data.current_code_actions().is_some() + != data.current_code_actions().is_some() + { + let offset = data.editor.cursor.offset(); + let (line, _) = data.buffer.offset_to_line_col(offset); + let rect = Rect::ZERO + .with_origin(Point::new(0.0, line as f64 * line_height)) + .with_size(Size::new(ctx.size().width, line_height)); + ctx.request_paint_rect(rect); + } + if old_data.on_diagnostic() != data.on_diagnostic() { ctx.request_paint(); }