This commit is contained in:
Mikayla
2024-01-17 15:52:54 -08:00
parent 647b08b101
commit 078fd35f4f
3 changed files with 77 additions and 11 deletions
+28
View File
@@ -0,0 +1,28 @@
use futures::Future;
use gpui::Task;
use smallvec::{smallvec, SmallVec};
use text::Anchor;
use crate::Editor;
struct Completions {
trigger_characters: SmallVec<[char; 1]>,
language: Option<String>,
provider: Box<dyn Fn(&mut Editor, &Anchor, &str) -> Option<Task<String>>>,
}
impl Completions {
fn new(f: impl Fn(&mut Editor, &Anchor, &str) -> Option<Task<String>> + 'static) -> Self {
Self {
trigger_characters: smallvec![],
language: None,
provider: Box::new(f),
}
}
}
impl Editor {
/// Provide completions to the editor when the given character is typed
///
fn provide_completions(config: Completions) {}
}
+14 -11
View File
@@ -2543,18 +2543,21 @@ impl EditorElement {
move |event: &MouseUpEvent, phase, cx| {
if phase == DispatchPhase::Bubble
&& interactive_bounds.visibly_contains(&event.position, cx)
{
editor.update(cx, |editor, cx| {
Self::mouse_up(
editor,
event,
&position_map,
text_bounds,
&stacking_order,
cx,
)
});
// if interactive_bounds.visibly_contains(&event.position, cx) {
editor.update(cx, |editor, cx| {
Self::mouse_up(
editor,
event,
&position_map,
text_bounds,
&stacking_order,
cx,
)
});
// } else {
// }
}
}
});