pub struct ServerState { /* private fields */ }Expand description
Global server state: the latest analyzed snapshot of every open document.
Snapshots are immutable Arcs: handlers clone the Arc out and drop the
map guard immediately, so a guard can never be held across an .await.
Text mutation and re-analysis live in the crate::scheduler; this map
only ever swaps in completed snapshots.
Implementations§
Source§impl ServerState
impl ServerState
pub fn new() -> Self
Sourcepub fn open_documents(&self) -> Vec<(Url, Arc<DocumentState>)>
pub fn open_documents(&self) -> Vec<(Url, Arc<DocumentState>)>
The latest snapshot for a document, if it is open and analyzed. Every open document’s latest snapshot — cross-file features consult LIVE buffers before the disk-backed workspace index.
pub fn snapshot(&self, uri: &Url) -> Option<Arc<DocumentState>>
Sourcepub fn install_snapshot(
&self,
uri: Url,
document: DocumentState,
) -> Arc<DocumentState>
pub fn install_snapshot( &self, uri: Url, document: DocumentState, ) -> Arc<DocumentState>
Swap in a freshly analyzed snapshot.
Sourcepub fn cache_semantic_tokens(
&self,
uri: Url,
data: Vec<SemanticToken>,
) -> String
pub fn cache_semantic_tokens( &self, uri: Url, data: Vec<SemanticToken>, ) -> String
Remember a semantic-token emission and mint its result id.
Sourcepub fn cached_semantic_tokens(
&self,
uri: &Url,
) -> Option<(String, Arc<Vec<SemanticToken>>)>
pub fn cached_semantic_tokens( &self, uri: &Url, ) -> Option<(String, Arc<Vec<SemanticToken>>)>
The previous emission for a document, if any.
pub fn close_document(&self, uri: &Url)
Auto Trait Implementations§
impl !Freeze for ServerState
impl !RefUnwindSafe for ServerState
impl Send for ServerState
impl Sync for ServerState
impl Unpin for ServerState
impl UnsafeUnpin for ServerState
impl UnwindSafe for ServerState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.