Skip to main content

swls_core/feature/
hover.rs

1use bevy_ecs::{
2    component::Component,
3    schedule::{IntoScheduleConfigs, Schedule, ScheduleLabel},
4    world::World,
5};
6
7pub use crate::{
8    systems::{hover_class, hover_property, hover_types, infer_types},
9    util::triple::get_current_triple,
10};
11
12/// [`Component`] indicating that the current document is handling a Hover request.
13#[derive(Component, Debug, Default)]
14pub struct HoverRequest(pub Vec<String>, pub Option<crate::lsp_types::Range>);
15
16/// [`ScheduleLabel`] related to the Hover schedule
17#[derive(ScheduleLabel, Clone, Eq, PartialEq, Debug, Hash)]
18pub struct Label;
19
20pub fn setup_schedule(world: &mut World) {
21    let mut hover = Schedule::new(Label);
22    hover.add_systems((
23        infer_types,
24        get_current_triple,
25        hover_types
26            .before(hover_class)
27            .before(hover_property)
28            .after(get_current_triple)
29            .after(infer_types),
30        hover_class.after(get_current_triple),
31        hover_property.after(get_current_triple),
32    ));
33    world.add_schedule(hover);
34}