@@ -28,7 +28,6 @@ use helix_lsp::lsp;
28pub struct Context<'a> {
28pub struct Context<'a> {
29 pub count: usize,
29 pub count: usize,
30 pub editor: &'a mut Editor,
30 pub editor: &'a mut Editor,
31− pub executor: &'static smol::Executor<'static>,
33 pub callback: Option<crate::compositor::Callback>,
32 pub callback: Option<crate::compositor::Callback>,
34 pub on_next_key_callback: Option<Box<dyn FnOnce(&mut Context, KeyEvent)>>,
33 pub on_next_key_callback: Option<Box<dyn FnOnce(&mut Context, KeyEvent)>>,
@@ -658,7 +657,6 @@ const COMMAND_LIST: &[&str] = &["write", "open", "quit"];
659// TODO: I, A, o and O can share a lot of the primitives.
658// TODO: I, A, o and O can share a lot of the primitives.
660pub fn command_mode(cx: &mut Context) {
659pub fn command_mode(cx: &mut Context) {
661− let executor = cx.executor;
662 let prompt = Prompt::new(
660 let prompt = Prompt::new(
663 ":".to_owned(),
661 ":".to_owned(),
664 |input: &str| {
662 |input: &str| {
@@ -695,11 +693,11 @@ pub fn command_mode(cx: &mut Context) {
696 match *parts.as_slice() {
694 match *parts.as_slice() {
697 ["q"] | ["quit"] => {
695 ["q"] | ["quit"] => {
698− editor.close(editor.view().id, executor);
696+ editor.close(editor.view().id);
699 // editor.should_close = true,
697 // editor.should_close = true,
701 ["o", path] | ["open", path] => {
699 ["o", path] | ["open", path] => {
702− editor.open(path.into(), executor);
700+ editor.open(path.into());
704 ["w"] | ["write"] => {
702 ["w"] | ["write"] => {
705 // TODO: non-blocking via save() command
703 // TODO: non-blocking via save() command
@@ -713,7 +711,7 @@ pub fn command_mode(cx: &mut Context) {
713 cx.push_layer(Box::new(prompt));
711 cx.push_layer(Box::new(prompt));
715pub fn file_picker(cx: &mut Context) {
713pub fn file_picker(cx: &mut Context) {
716− let picker = ui::file_picker("./", cx.executor);
714+ let picker = ui::file_picker("./");
717 cx.push_layer(Box::new(picker));
715 cx.push_layer(Box::new(picker));
@@ -851,15 +849,13 @@ pub fn exit_select_mode(cx: &mut Context) {
853fn goto(cx: &mut Context, locations: Vec<lsp::Location>) {
851fn goto(cx: &mut Context, locations: Vec<lsp::Location>) {
854− let executor = cx.executor;
855 let doc = cx.doc();
852 let doc = cx.doc();
857 doc.mode = Mode::Normal;
854 doc.mode = Mode::Normal;
859 match locations.as_slice() {
856 match locations.as_slice() {
860 [location] => {
857 [location] => {
862− .open(PathBuf::from(location.uri.path()), cx.executor);
858+ cx.editor.open(PathBuf::from(location.uri.path()));
863 let doc = cx.doc();
859 let doc = cx.doc();
864 let definition_pos = location.range.start;
860 let definition_pos = location.range.start;
865 let new_pos = helix_lsp::util::lsp_pos_to_pos(doc.text().slice(..), definition_pos);
861 let new_pos = helix_lsp::util::lsp_pos_to_pos(doc.text().slice(..), definition_pos);
@@ -875,7 +871,7 @@ fn goto(cx: &mut Context, locations: Vec<lsp::Location>) {
875 format!("{}:{}", file, line).into()
871 format!("{}:{}", file, line).into()
877 move |editor: &mut Editor, item| {
873 move |editor: &mut Editor, item| {
878− editor.open(PathBuf::from(item.uri.path()), &executor);
874+ editor.open(PathBuf::from(item.uri.path()));
879 let mut doc = &mut editor.view_mut().doc;
875 let mut doc = &mut editor.view_mut().doc;
880 let definition_pos = item.range.start;
876 let definition_pos = item.range.start;
881 let new_pos =
877 let new_pos =
@@ -1274,7 +1270,7 @@ pub fn save(cx: &mut Context) {
1274 // Spawns an async task to actually do the saving. This way we prevent blocking.
1270 // Spawns an async task to actually do the saving. This way we prevent blocking.
1276 // TODO: handle save errors somehow?
1272 // TODO: handle save errors somehow?
1277− cx.executor.spawn(cx.doc().save()).detach();
1273+ cx.editor.executor.spawn(cx.doc().save()).detach();
1280pub fn completion(cx: &mut Context) {
1276pub fn completion(cx: &mut Context) {