code actions light bulb

This commit is contained in:
Dongdong Zhou 2021-07-30 18:05:33 +01:00
parent e205a885c0
commit 56296d79c7
1 changed files with 12 additions and 1 deletions

View File

@ -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();
}