pub struct Workspace { /* private fields */ }Expand description
Cloneable handle to the connection’s workspace state (ADR 0017, ADR 0034).
Cheap to clone: every copy shares one Arc, so clones observe the same
connection state rather than a snapshot of it. The engine owns
construction from InitializeParams; user code only reads it through
ServerContext::workspace.
Implementations§
Source§impl Workspace
impl Workspace
Sourcepub fn client_info(&self) -> Option<&ClientInfo>
pub fn client_info(&self) -> Option<&ClientInfo>
The client info (clientInfo.name / clientInfo.version) announced at
initialization, if the client sent any.
Sourcepub fn capabilities(&self) -> &ClientCapabilities
pub fn capabilities(&self) -> &ClientCapabilities
The client capabilities announced at initialization, stored verbatim.
Sourcepub fn initialization_options(&self) -> Option<&Value>
pub fn initialization_options(&self) -> Option<&Value>
The client-provided initialization options, exactly as sent.
Sourcepub fn folders(&self) -> Vec<WorkspaceFolder>
pub fn folders(&self) -> Vec<WorkspaceFolder>
The current workspace folders as an owned, order-preserving snapshot.
Sourcepub fn configuration(&self) -> Option<Value>
pub fn configuration(&self) -> Option<Value>
The latest raw workspace/didChangeConfiguration settings value.
The framework neither interprets this value nor persists it outside the connection-owned workspace.
Sourcepub fn trace(&self) -> TraceValue
pub fn trace(&self) -> TraceValue
The connection’s current protocol trace level.
Sourcepub fn roots(&self) -> Vec<WorkspaceFolder>
pub fn roots(&self) -> Vec<WorkspaceFolder>
The effective workspace roots.
Prefers the announced workspace folders; with none — an absent or
empty list — falls back to one synthetic root derived from rootUri,
named for its final path segment (percent-decoded, since the name is
a display string) or "workspace" when there is none. With no
folders and no rootUri, there are no roots.
Sourcepub fn documents(&self) -> DocumentsView
pub fn documents(&self) -> DocumentsView
The connection’s documents, as a read-only DocumentsView.
The workspace owns the document store the engine mutates through its
built-in document-sync handling; user code reads it through this view
(or ServerContext::documents, which is the
same view).
Sourcepub fn notebooks(&self) -> NotebooksView
pub fn notebooks(&self) -> NotebooksView
The connection’s notebooks, as a read-only NotebooksView.
Notebook snapshots contain metadata and ordered cell membership. Read
each cell’s text through Workspace::documents using its URI.
Sourcepub async fn text_document(&self, uri: &Uri) -> Result<Document, WorkspaceError>
pub async fn text_document(&self, uri: &Uri) -> Result<Document, WorkspaceError>
Resolve a document snapshot, preferring editor-open text over the configured provider for unopened resources.