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;
|
mod inlay_hint_cache;
|
||||||
|
|
||||||
use self::inlay_hint_cache::InlayHintCache;
|
use self::inlay_hint_cache::BufferInlayHints;
|
||||||
use crate::{
|
use crate::{
|
||||||
CodeAction, ColorPresentation, Completion, CompletionResponse, CompletionSource,
|
CodeAction, ColorPresentation, Completion, CompletionResponse, CompletionSource,
|
||||||
CoreCompletion, DocumentColor, Hover, InlayHint, LocationLink, LspAction, LspPullDiagnostics,
|
CoreCompletion, DocumentColor, Hover, InlayHint, LocationLink, LspAction, LspPullDiagnostics,
|
||||||
|
@ -994,7 +994,7 @@ impl LocalLspStore {
|
||||||
})
|
})
|
||||||
.detach();
|
.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);
|
rust_analyzer_ext::register_notifications(lsp_store.clone(), language_server);
|
||||||
clangd_ext::register_notifications(lsp_store, language_server, adapter);
|
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>,
|
pub(super) lsp_server_capabilities: HashMap<LanguageServerId, lsp::ServerCapabilities>,
|
||||||
lsp_document_colors: HashMap<BufferId, DocumentColorData>,
|
lsp_document_colors: HashMap<BufferId, DocumentColorData>,
|
||||||
lsp_code_lens: HashMap<BufferId, CodeLensData>,
|
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<()>>)>,
|
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)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct InlayHintId(usize);
|
pub struct InlayHintId(usize);
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Default)]
|
||||||
pub struct InlayHintCache {
|
pub struct BufferInlayHints {
|
||||||
buffer_store: Entity<BufferStore>,
|
all_hints: HashMap<InlayHintId, InlayHint>,
|
||||||
hints_for_version: Global,
|
hints: HashMap<LanguageServerId, HintChunks>,
|
||||||
hints: HashMap<LanguageServerId, Hints>,
|
chunks_for_version: Global,
|
||||||
cache_version: usize,
|
cache_version: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
struct Hints {
|
struct HintChunks {
|
||||||
hints: HashMap<InlayHintId, InlayHint>,
|
|
||||||
hints_by_chunks: BTreeMap<Range<BufferRow>, Option<Vec<InlayHintId>>>,
|
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 {
|
pub struct InlayHints {
|
||||||
|
@ -39,7 +38,7 @@ pub enum HintFetchStrategy {
|
||||||
UseCache { known_cache_version: Option<usize> },
|
UseCache { known_cache_version: Option<usize> },
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InlayHintCache {
|
impl BufferInlayHints {
|
||||||
pub fn remove_server_data(&mut self, for_server: LanguageServerId) -> bool {
|
pub fn remove_server_data(&mut self, for_server: LanguageServerId) -> bool {
|
||||||
let removed = self.hints.remove(&for_server).is_some();
|
let removed = self.hints.remove(&for_server).is_some();
|
||||||
if removed {
|
if removed {
|
||||||
|
@ -50,6 +49,7 @@ impl InlayHintCache {
|
||||||
|
|
||||||
pub fn hints(
|
pub fn hints(
|
||||||
&self,
|
&self,
|
||||||
|
buffer_store: Entity<BufferStore>,
|
||||||
buffer: BufferId,
|
buffer: BufferId,
|
||||||
strategy: HintFetchStrategy,
|
strategy: HintFetchStrategy,
|
||||||
range: impl text::ToOffset,
|
range: impl text::ToOffset,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue