feat: add selection, active line, and incremental highlighting to code
view
This commit is contained in:
@@ -7,7 +7,7 @@ use gpui::{
|
||||
ScrollDelta, ScrollEvent, Styled as _, TestAppContext, VisualTestContext, Window, div, point,
|
||||
px,
|
||||
};
|
||||
use gpui_native_editor::code_view::CodeViewState;
|
||||
use gpui_native_editor::code_view::{CodeViewState, bind_code_view_keys};
|
||||
use gpui_native_editor::highlight::Language;
|
||||
|
||||
/// Deterministic pseudo-Rust with mixed tokens, roughly `lines` lines long.
|
||||
@@ -50,12 +50,17 @@ impl Render for Host {
|
||||
#[test]
|
||||
fn scrolling_a_large_file_is_not_pathologically_slow() {
|
||||
let mut cx = TestAppContext::single();
|
||||
cx.update(gpui_native_theme::Theme::init);
|
||||
cx.update(|cx| {
|
||||
gpui_native_theme::Theme::init(cx);
|
||||
bind_code_view_keys(cx);
|
||||
});
|
||||
|
||||
let source = large_source(5000);
|
||||
let started = Instant::now();
|
||||
let state = CodeViewState::new("bench-code", source.clone(), Language::Rust);
|
||||
let highlight_elapsed = started.elapsed();
|
||||
let (state, highlight_elapsed) = cx.update(|cx| {
|
||||
let state = CodeViewState::new("bench-code", source.clone(), Language::Rust, cx);
|
||||
(state, started.elapsed())
|
||||
});
|
||||
|
||||
let state_cell: Rc<RefCell<Option<Entity<CodeViewState>>>> = Rc::new(RefCell::new(None));
|
||||
let cell = state_cell.clone();
|
||||
|
||||
Reference in New Issue
Block a user