From 5cf3dcfdfd24f5a19ce5cfbf98721f57e8b1e193 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Wed, 23 Jul 2025 16:46:09 +0300 Subject: [PATCH] Reorder the hint data --- crates/project/src/lsp_store.rs | 6 +++--- .../project/src/lsp_store/inlay_hint_cache.rs | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rs index ce3f765d24..c5e0b726d3 100644 --- a/crates/project/src/lsp_store.rs +++ b/crates/project/src/lsp_store.rs @@ -16,7 +16,7 @@ pub mod rust_analyzer_ext; mod inlay_hint_cache; -use self::inlay_hint_cache::InlayHintCache; +use self::inlay_hint_cache::BufferInlayHints; use crate::{ CodeAction, ColorPresentation, Completion, CompletionResponse, CompletionSource, CoreCompletion, DocumentColor, Hover, InlayHint, LocationLink, LspAction, LspPullDiagnostics, @@ -994,7 +994,7 @@ impl LocalLspStore { }) .detach(); - json_language_server_ext::register_requests(this.clone(), language_server); + json_language_server_ext::register_requests(lsp_store.clone(), language_server); rust_analyzer_ext::register_notifications(lsp_store.clone(), language_server); clangd_ext::register_notifications(lsp_store, language_server, adapter); } @@ -3498,7 +3498,7 @@ pub struct LspStore { pub(super) lsp_server_capabilities: HashMap, lsp_document_colors: HashMap, lsp_code_lens: HashMap, - inlay_hint_data: HashMap, + inlay_hint_data: HashMap, running_lsp_requests: HashMap>)>, } diff --git a/crates/project/src/lsp_store/inlay_hint_cache.rs b/crates/project/src/lsp_store/inlay_hint_cache.rs index ba64a4e16f..e700bf7c6e 100644 --- a/crates/project/src/lsp_store/inlay_hint_cache.rs +++ b/crates/project/src/lsp_store/inlay_hint_cache.rs @@ -13,19 +13,18 @@ use crate::{InlayHint, buffer_store::BufferStore}; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct InlayHintId(usize); -#[derive(Debug)] -pub struct InlayHintCache { - buffer_store: Entity, - hints_for_version: Global, - hints: HashMap, +#[derive(Debug, Default)] +pub struct BufferInlayHints { + all_hints: HashMap, + hints: HashMap, + chunks_for_version: Global, cache_version: usize, } #[derive(Debug, Default)] -struct Hints { - hints: HashMap, +struct HintChunks { hints_by_chunks: BTreeMap, Option>>, - hint_updates: HashMap, Shared>>, + chunk_updates: HashMap, Shared>>, } pub struct InlayHints { @@ -39,7 +38,7 @@ pub enum HintFetchStrategy { UseCache { known_cache_version: Option }, } -impl InlayHintCache { +impl BufferInlayHints { pub fn remove_server_data(&mut self, for_server: LanguageServerId) -> bool { let removed = self.hints.remove(&for_server).is_some(); if removed { @@ -50,6 +49,7 @@ impl InlayHintCache { pub fn hints( &self, + buffer_store: Entity, buffer: BufferId, strategy: HintFetchStrategy, range: impl text::ToOffset,