pub enum LspOverlayMessage {
HoverEntered,
HoverExited,
CompletionSelected(usize),
CompletionClosed,
CompletionNavigateUp,
CompletionNavigateDown,
CompletionConfirm,
}Expand description
Messages produced by LSP overlay UI interactions.
Use these in your application’s update function to handle hover
and completion interactions, driving LspOverlayState with the matching
method (LspOverlayState::navigate, LspOverlayState::clear_completions,
and friends). The keyboard variants let a host route Up/Down/Enter to the
completion menu while it is open, instead of to the editor.
§Examples
use iced::Point;
use iced_code_editor::{LspOverlayMessage, LspOverlayState};
let mut state = LspOverlayState::new();
state.set_completions(
vec!["main".to_string(), "map".to_string()],
Point::ORIGIN,
);
// Route the keyboard variants to the overlay while the menu is open.
let selected = match LspOverlayMessage::CompletionNavigateDown {
LspOverlayMessage::CompletionNavigateDown => {
state.navigate(1);
state.selected_item()
}
LspOverlayMessage::CompletionNavigateUp => {
state.navigate(-1);
state.selected_item()
}
_ => None,
};
assert_eq!(selected, Some("map"));
// Dismissing clears the menu.
state.clear_completions();
assert!(!state.completion_visible);Variants§
HoverEntered
The mouse cursor entered the hover tooltip area.
HoverExited
The mouse cursor exited the hover tooltip area.
CompletionSelected(usize)
A completion item at the given index was clicked.
CompletionClosed
The completion menu was dismissed by clicking outside it.
Navigate up in the completion list (e.g., keyboard Up arrow).
Navigate down in the completion list (e.g., keyboard Down arrow).
CompletionConfirm
Confirm the currently highlighted completion item (e.g., Enter key).
Trait Implementations§
Source§impl Clone for LspOverlayMessage
impl Clone for LspOverlayMessage
Auto Trait Implementations§
impl Forget for LspOverlayMessage
impl Freeze for LspOverlayMessage
impl Move for LspOverlayMessage
impl RefUnwindSafe for LspOverlayMessage
impl Send for LspOverlayMessage
impl Sync for LspOverlayMessage
impl Unpin for LspOverlayMessage
impl UnsafeUnpin for LspOverlayMessage
impl UnwindSafe for LspOverlayMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.