Reorder the hint data
This commit is contained in:
parent
0afe7c3210
commit
5cf3dcfdfd
2 changed files with 12 additions and 12 deletions
|
@ -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<LanguageServerId, lsp::ServerCapabilities>,
|
||||
lsp_document_colors: HashMap<BufferId, DocumentColorData>,
|
||||
lsp_code_lens: HashMap<BufferId, CodeLensData>,
|
||||
inlay_hint_data: HashMap<BufferId, InlayHintCache>,
|
||||
inlay_hint_data: HashMap<BufferId, BufferInlayHints>,
|
||||
running_lsp_requests: HashMap<TypeId, (Global, HashMap<LspRequestId, Task<()>>)>,
|
||||
}
|
||||
|
||||
|
|
|
@ -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<BufferStore>,
|
||||
hints_for_version: Global,
|
||||
hints: HashMap<LanguageServerId, Hints>,
|
||||
#[derive(Debug, Default)]
|
||||
pub struct BufferInlayHints {
|
||||
all_hints: HashMap<InlayHintId, InlayHint>,
|
||||
hints: HashMap<LanguageServerId, HintChunks>,
|
||||
chunks_for_version: Global,
|
||||
cache_version: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
struct Hints {
|
||||
hints: HashMap<InlayHintId, InlayHint>,
|
||||
struct HintChunks {
|
||||
hints_by_chunks: BTreeMap<Range<BufferRow>, Option<Vec<InlayHintId>>>,
|
||||
hint_updates: HashMap<Range<BufferRow>, Shared<Task<InlayHints>>>,
|
||||
chunk_updates: HashMap<Range<BufferRow>, Shared<Task<InlayHints>>>,
|
||||
}
|
||||
|
||||
pub struct InlayHints {
|
||||
|
@ -39,7 +38,7 @@ pub enum HintFetchStrategy {
|
|||
UseCache { known_cache_version: Option<usize> },
|
||||
}
|
||||
|
||||
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<BufferStore>,
|
||||
buffer: BufferId,
|
||||
strategy: HintFetchStrategy,
|
||||
range: impl text::ToOffset,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue