diff --git a/crates/editor/src/completions.rs b/crates/editor/src/completions.rs new file mode 100644 index 0000000000000000000000000000000000000000..b9461364af44e686fc7207d2dd1c800a49156394 --- /dev/null +++ b/crates/editor/src/completions.rs @@ -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, + provider: Box Option>>, +} + +impl Completions { + fn new(f: impl Fn(&mut Editor, &Anchor, &str) -> Option> + '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) {} +} diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index b82bd55bcf5e898299ca8a3a0e1d88cf37c72367..518e03c27ee1e3670c7b53df213bf9200dd56998 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -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 { + + // } } } }); diff --git a/crates/gpui/src/platform/mac/window_appearance.rs b/crates/gpui/src/platform/mac/window_appearance.rs new file mode 100644 index 0000000000000000000000000000000000000000..2edc896289ef8056424a0399d38ff937155adad2 --- /dev/null +++ b/crates/gpui/src/platform/mac/window_appearance.rs @@ -0,0 +1,35 @@ +use crate::WindowAppearance; +use cocoa::{ + appkit::{NSAppearanceNameVibrantDark, NSAppearanceNameVibrantLight}, + base::id, + foundation::NSString, +}; +use objc::{msg_send, sel, sel_impl}; +use std::ffi::CStr; + +impl WindowAppearance { + pub unsafe fn from_native(appearance: id) -> Self { + let name: id = msg_send![appearance, name]; + if name == NSAppearanceNameVibrantLight { + Self::VibrantLight + } else if name == NSAppearanceNameVibrantDark { + Self::VibrantDark + } else if name == NSAppearanceNameAqua { + Self::Light + } else if name == NSAppearanceNameDarkAqua { + Self::Dark + } else { + println!( + "unknown appearance: {:?}", + CStr::from_ptr(name.UTF8String()) + ); + Self::Light + } + } +} + +#[link(name = "AppKit", kind = "framework")] +extern "C" { + pub static NSAppearanceNameAqua: id; + pub static NSAppearanceNameDarkAqua: id; +}