diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index a54bd68118..3b4dc3d80e 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -126,7 +126,7 @@ use language::{ Language, OffsetRangeExt, Point, Runnable, RunnableRange, Selection, SelectionGoal, TextObject, TransactionId, TreeSitterOptions, WordsQuery, language_settings::{ - self, InlayHintSettings, LspInsertMode, RewrapBehavior, WordsCompletionMode, + self, InlayHintKind, InlayHintSettings, LspInsertMode, RewrapBehavior, WordsCompletionMode, all_language_settings, language_settings, }, point_from_lsp, point_to_lsp, text_diff_with_options, @@ -1177,9 +1177,35 @@ pub struct Editor { selection_drag_state: SelectionDragState, next_color_inlay_id: usize, colors: Option, + inlay_hints: Option, folding_newlines: Task<()>, } +#[derive(Debug)] +struct LspInlayHintData { + enabled: bool, + modifiers_override: bool, + enabled_in_settings: bool, + allowed_hint_kinds: HashSet>, + cache_version: Option, + inlays: Vec, + inlay_tasks: HashMap, Task<()>>>, +} + +impl LspInlayHintData { + pub fn new(settings: InlayHintSettings) -> Self { + Self { + modifiers_override: false, + enabled: settings.enabled, + enabled_in_settings: settings.enabled, + inlays: Vec::new(), + inlay_tasks: HashMap::default(), + allowed_hint_kinds: settings.enabled_inlay_hint_kinds(), + cache_version: None, + } + } +} + #[derive(Copy, Clone, Debug, PartialEq, Eq, Default)] enum NextScrollCursorCenterTopBottom { #[default] @@ -2233,6 +2259,7 @@ impl Editor { tasks_update_task: None, pull_diagnostics_task: Task::ready(()), colors: None, + inlay_hints: None, next_color_inlay_id: 0, linked_edit_ranges: Default::default(), in_project_search: false, @@ -2381,6 +2408,7 @@ impl Editor { editor.minimap = editor.create_minimap(EditorSettings::get_global(cx).minimap, window, cx); editor.colors = Some(LspColorData::new(cx)); + editor.inlay_hints = Some(LspInlayHintData::new(inlay_hint_settings)); editor.update_lsp_data(false, None, window, cx); } diff --git a/crates/project/src/lsp_store/inlay_hint_cache.rs b/crates/project/src/lsp_store/inlay_hint_cache.rs index 6b92e32c81..ab610f8640 100644 --- a/crates/project/src/lsp_store/inlay_hint_cache.rs +++ b/crates/project/src/lsp_store/inlay_hint_cache.rs @@ -48,7 +48,7 @@ impl InlayHintCache { range: Range, known_cache_version: Option, cx: &mut Context, - ) -> Option>> { + ) -> Option<(Range, Shared>)> { todo!("TODO kb") } // we want to store the cache version outbound, so they can query with it: we can return nothing (`Option`) if the version matches