mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 23:25:03 +00:00
More robust status notifications
This commit is contained in:
parent
9143e3925c
commit
8fe20b19d4
11 changed files with 169 additions and 154 deletions
|
@ -23,6 +23,7 @@ use crate::{
|
|||
document::DocumentData,
|
||||
from_proto,
|
||||
line_index::{LineEndings, LineIndex},
|
||||
lsp_ext,
|
||||
main_loop::Task,
|
||||
op_queue::OpQueue,
|
||||
reload::SourceRootConfig,
|
||||
|
@ -32,20 +33,6 @@ use crate::{
|
|||
Result,
|
||||
};
|
||||
|
||||
#[derive(Eq, PartialEq, Copy, Clone)]
|
||||
pub(crate) enum Status {
|
||||
Loading,
|
||||
Ready { partial: bool },
|
||||
Invalid,
|
||||
NeedsReload,
|
||||
}
|
||||
|
||||
impl Default for Status {
|
||||
fn default() -> Self {
|
||||
Status::Loading
|
||||
}
|
||||
}
|
||||
|
||||
// Enforces drop order
|
||||
pub(crate) struct Handle<H, C> {
|
||||
pub(crate) handle: H,
|
||||
|
@ -73,7 +60,7 @@ pub(crate) struct GlobalState {
|
|||
pub(crate) mem_docs: FxHashMap<VfsPath, DocumentData>,
|
||||
pub(crate) semantic_tokens_cache: Arc<Mutex<FxHashMap<Url, SemanticTokens>>>,
|
||||
pub(crate) shutdown_requested: bool,
|
||||
pub(crate) status: Status,
|
||||
pub(crate) last_reported_status: Option<lsp_ext::ServerStatusParams>,
|
||||
pub(crate) source_root_config: SourceRootConfig,
|
||||
pub(crate) proc_macro_client: Option<ProcMacroClient>,
|
||||
|
||||
|
@ -83,6 +70,7 @@ pub(crate) struct GlobalState {
|
|||
|
||||
pub(crate) vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>,
|
||||
pub(crate) vfs_config_version: u32,
|
||||
pub(crate) vfs_progress_config_version: u32,
|
||||
pub(crate) vfs_progress_n_total: usize,
|
||||
pub(crate) vfs_progress_n_done: usize,
|
||||
|
||||
|
@ -141,7 +129,7 @@ impl GlobalState {
|
|||
mem_docs: FxHashMap::default(),
|
||||
semantic_tokens_cache: Arc::new(Default::default()),
|
||||
shutdown_requested: false,
|
||||
status: Status::default(),
|
||||
last_reported_status: None,
|
||||
source_root_config: SourceRootConfig::default(),
|
||||
proc_macro_client: None,
|
||||
|
||||
|
@ -151,14 +139,15 @@ impl GlobalState {
|
|||
|
||||
vfs: Arc::new(RwLock::new((vfs::Vfs::default(), FxHashMap::default()))),
|
||||
vfs_config_version: 0,
|
||||
vfs_progress_config_version: 0,
|
||||
vfs_progress_n_total: 0,
|
||||
vfs_progress_n_done: 0,
|
||||
|
||||
workspaces: Arc::new(Vec::new()),
|
||||
fetch_workspaces_queue: OpQueue::default(),
|
||||
workspace_build_data: None,
|
||||
fetch_build_data_queue: OpQueue::default(),
|
||||
|
||||
fetch_build_data_queue: OpQueue::default(),
|
||||
latest_requests: Default::default(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue