@@ -200,9 +200,9 @@ impl Application {
200200 self.render();
201201 }
202202 _ = &mut self.editor.idle_timer => {
203+ // idle timeout
203204 self.editor.clear_idle_timer();
204− println!("idle!")
205− // idle timeout
205+ self.handle_idle_timeout();
206206 }
207207 }
208208 }
@@ -233,6 +233,40 @@ impl Application {
233233 }
234234 }
235235
236+ pub fn handle_idle_timeout(&mut self) {
237+ use helix_view::document::Mode;
238+ use crate::commands::{Context, completion};
239+
240+
241+ if doc_mut!(self.editor).mode != Mode::Insert {
242+ return;
243+ }
244+ let editor_view = self
245+ .compositor
246+ .find(std::any::type_name::<ui::EditorView>())
247+ .expect("expected at least one EditorView");
248+ let editor_view = editor_view
249+ .as_any_mut()
250+ .downcast_mut::<ui::EditorView>()
251+ .unwrap();
252+
253+ if editor_view.completion.is_some() {
254+ return;
255+ }
256+
257+ let mut cx = Context {
258+ selected_register: helix_view::RegisterSelection::default(),
259+ editor: &mut self.editor,
260+ jobs: &mut self.jobs,
261+ count: None,
262+ callback: None,
263+ on_next_key_callback: None,
264+ };
265+ completion(&mut cx);
266+ // TODO: scan backwards for trigger and filter the box
267+ self.render();
268+ }
269+
236270 pub fn handle_terminal_events(&mut self, event: Option<Result<Event, crossterm::ErrorKind>>) {
237271 let mut cx = crate::compositor::Context {
238272 editor: &mut self.editor,