Skip to main content

ServerHandle

Struct ServerHandle 

Source
pub struct ServerHandle { /* private fields */ }
Expand description

Editor-facing handle to one running language-server actor.

Cheap to clone (Arc internally); the editor passes one around per buffer / pane that talks to this server. Dropping the last clone closes the mailbox – the actor sees the channel close and runs the LSP shutdown sequence on its way out, so no leak.

Implementations§

Source§

impl ServerHandle

Source

pub fn capabilities(&self) -> Arc<Capabilities> ⓘ

Snapshot of the current negotiated capabilities. Each call returns a fresh Arc that includes any dynamic registrations the server has issued since handshake (4.4.n). Callers that need the capability set to be stable for a multi-step decision should bind the snapshot to a local variable; subsequent capabilities() calls see whatever the actor has published in the interim.

Source

pub fn server_id(&self) -> &str

Server’s stable id (e.g. "rust"). Useful for logs and for the supervisor to look up ServerConfig.

Source

pub fn workspace_root(&self) -> Arc<Path> ⓘ

Workspace root this actor was spawned against. Pairs with server_id() as the canonical instance identity (B’.2); cheap clone (Arc bump).

Source

pub fn instance(&self) -> InstanceKey

Build the (server_id, workspace) instance key for use with LspLogger::log and the per-instance log ring.

Source

pub fn subscribe_diagnostics(&self) -> Receiver<DiagnosticEvent>

Subscribe to this server’s diagnostics broadcast. Each subscriber receives every publishDiagnostics event after the call – prior events are not replayed (a freshly opened pane re-issues the URIs it cares about to the server, which republishes diagnostics for those).

The returned Receiver is the standard tokio::sync::broadcast::Receiver. A lagging consumer drops oldest first; reconcile by tracking the latest version per URI and ignoring events older than the editor’s view of the doc.

Source

pub fn diagnostics_subscriber_count(&self) -> usize

True iff at least one subscriber is currently listening. Used by tests; production code doesn’t need this.

Source

pub fn logger(&self) -> &LspLogger

Borrow the logger this actor emits through. The App holds the same LspLogger (cloned) and uses it for supervisor-side records.

Source

pub fn request<P, R>(&self, method: &str, params: P) -> Pending<R> ⓘ
where P: Serialize, R: DeserializeOwned + Send + 'static,

Send a typed JSON-RPC request and return a Pending resolving to the deserialized response.

R must match the server’s response shape for method; a mismatch surfaces as LspError::ResponseDecode.

Source

pub fn request_with_cancel<P, R>( &self, method: &str, params: P, token: CancellationToken, ) -> Pending<R> ⓘ
where P: Serialize, R: DeserializeOwned + Send + 'static,

Same as Self::request but with cooperative cancellation driven by a [lattice_protocol::CancellationToken]. While the relay task is awaiting the response from the actor, it also polls the token; if the token flips before the response arrives, the relay resolves with LspError::Cancelled.

Local-only cancellation today. The server may keep computing – we just drop its result if it arrives stale. $/cancelRequest over the wire is a Phase 4.2 polish item (requires plumbing the JSON-RPC id back from the actor for server-side cancel; not on a hot path).

Used by every Phase 4.2 navigation feature (Self::hover / Self::goto_definition / …) so stale popups don’t appear after the user moves on.

Source

pub fn notify<P: Serialize>(&self, method: &str, params: P) -> LspResult<()>

Fire a JSON-RPC notification (no response expected).

Source

pub fn set_trace(&self, value: TraceValue) -> LspResult<()>

4.4.b: send $/setTrace { value } to the server (LSP §3.18). Off silences trace records; Messages ships the wire shapes; Verbose ships shapes + parameter contents. The server replies with $/logTrace notifications which the host routes into the *lsp:<server>:trace* ring.

Source

pub fn cancel_progress(&self, token: &str) -> LspResult<()>

Cancel an in-flight server-side $/progress operation (LSP §3.16 window/workDoneProgress/cancel). The server is asked to wind down the work tied to token; whether it complies is server-specific. The host treats the cancel as best-effort — the modeline keeps the entry until an end progress notification arrives.

Source

pub fn cancel(&self, jsonrpc_id: i64) -> LspResult<()>

Cancel a pending request by JSON-RPC numeric id (LSP $/cancelRequest). The actor sends the cancel notification and resolves the matching pending oneshot with LspError::Cancelled.

Note: the JSON-RPC id is server-internal – callers usually don’t have it. The higher-level cancellation path uses [lattice_runtime::CancellationToken] which the editor binds to a request via request_with_cancel (added in 4.2 alongside the navigation features).

Source

pub fn open_doc( &self, uri: Uri, language_id: impl Into<String>, text: impl Into<String>, ) -> LspResult<()>

Open a document in the actor’s own DocSync mirror and emit textDocument/didOpen. Single-writer through the actor: the supervisor mutex is no longer in this path, so the UI thread cannot stall behind a flush. FIFO ordering with subsequent record_edit calls is preserved by the cmd channel.

Source

pub fn record_edit(&self, uri: Uri, edit: Edit) -> LspResult<()>

Record an edit against the actor’s mirror. Coalesced with other edits and flushed after the actor’s debounce window. Drop-free: the cmd channel is unbounded, so the publisher (typically the per-server fan-in task) cannot lose work.

Source

pub fn flush(&self, uri: Uri) -> LspResult<()>

Force a flush of the pending change queue for one URI. Useful before a synchronous request that depends on the server having seen the latest text (hover/definition right after typing).

Source

pub fn flush_all(&self) -> LspResult<()>

Force a flush of every URI tracked by this actor.

Source

pub fn close_doc(&self, uri: Uri) -> LspResult<()>

Close a document: emit any final textDocument/didChange then textDocument/didClose, all from inside the actor.

Source

pub fn shutdown(&self) -> Pending<()> ⓘ

Run the LSP shutdown sequence: shutdown request → exit notification → wait for child exit. After this resolves the actor task is gone; subsequent requests yield LspError::ActorGone.

Source§

impl ServerHandle

Source

pub fn hover( &self, params: HoverParams, token: CancellationToken, ) -> Pending<Option<Hover>> ⓘ

textDocument/hover (DESIGN.md §5.4 / docs/dev/notes/lsp-features.md). Returns None when the server has nothing to say at the cursor position. The body’s contents field is what the renderer feeds into the hover popup markdown pipeline (App-side HoverPopup); the optional range highlights the symbol hovered (renderer integration is Phase 4.2.b polish).

Source

pub fn goto_definition( &self, params: GotoDefinitionParams, token: CancellationToken, ) -> Pending<Option<GotoDefinitionResponse>> ⓘ

textDocument/definition (DESIGN.md §5.4 / docs/dev/notes/lsp-features.md). Returns the location(s) where the symbol under the cursor is defined. GotoDefinitionResponse is an enum: single Location, Vec<Location>, or Vec<LocationLink> (richer links carrying origin range). Phase 4.2.c picks one (single → jump, multiple → list).

Source

pub fn goto_declaration( &self, params: GotoDeclarationParams, token: CancellationToken, ) -> Pending<Option<GotoDeclarationResponse>> ⓘ

textDocument/declaration (DESIGN.md §5.4 / docs/dev/notes/lsp-features.md). gD family. Same response shape as goto_definition; servers usually point at the forward declaration (header file in C / extern statement in Rust) rather than the implementation. Multi-server merge dedups by (uri, range.start) like definition.

Source

pub fn goto_type_definition( &self, params: GotoTypeDefinitionParams, token: CancellationToken, ) -> Pending<Option<GotoTypeDefinitionResponse>> ⓘ

textDocument/typeDefinition (DESIGN.md §5.4). gy family. “Where is the type of this expression defined?” Useful for stepping from a value to its struct / class / interface.

Source

pub fn goto_implementation( &self, params: GotoImplementationParams, token: CancellationToken, ) -> Pending<Option<GotoImplementationResponse>> ⓘ

textDocument/implementation (DESIGN.md §5.4). gI family. “Where are the implementations of this trait / interface?” Often returns multiple locations (one per impl); we share definition’s pick-or-list dispatch.

Source

pub fn references( &self, params: ReferenceParams, token: CancellationToken, ) -> Pending<Option<Vec<Location>>> ⓘ

textDocument/references (DESIGN.md §5.4). Returns every reference site to the symbol under the cursor. The include_declaration flag sits on ReferenceContext inside ReferenceParams; callers usually want it true for gr (vim convention).

Source

pub fn document_symbol( &self, params: DocumentSymbolParams, token: CancellationToken, ) -> Pending<Option<DocumentSymbolResponse>> ⓘ

textDocument/documentSymbol (DESIGN.md §5.4). Returns the symbol outline for the buffer. Response is either flat Vec<SymbolInformation> (legacy) or hierarchical Vec<DocumentSymbol> (modern). Phase 4.2.e flattens the hierarchy to a list with depth-indent for the picker.

Source

pub fn workspace_symbol( &self, params: WorkspaceSymbolParams, token: CancellationToken, ) -> Pending<Option<WorkspaceSymbolResponse>> ⓘ

workspace/symbol (DESIGN.md §5.4). Workspace-scoped symbol search. The query string filters server-side; the editor sends query="" for an everything-list and re-queries as the user types in the picker (Phase 4.2.f).

Response shape: WorkspaceSymbolResponse – the Flat(Vec<SymbolInformation>) variant is the legacy shape every server emits; the Nested(Vec<WorkspaceSymbol>) variant (LSP 3.17+) lets the server defer the location.range and have the client fire workspaceSymbol/resolve on accept. The editor handles both shapes – legacy rows jump immediately; nested rows with a WorkspaceLocation route through the resolve path before jumping.

Source

pub fn workspace_symbol_resolve( &self, symbol: WorkspaceSymbol, token: CancellationToken, ) -> Pending<WorkspaceSymbol> ⓘ

workspaceSymbol/resolve (LSP 3.17+, Phase 4.2 follow-up). Sent for WorkspaceSymbol rows whose location came back as the WorkspaceLocation (URI-only) variant; the server returns the same symbol with location.range populated. Wired into the :workspace-symbols picker accept path when the server advertises workspaceSymbolProvider.resolveProvider.

Source

pub fn prepare_call_hierarchy( &self, params: CallHierarchyPrepareParams, token: CancellationToken, ) -> Pending<Option<Vec<CallHierarchyItem>>> ⓘ

4.5.a: textDocument/prepareCallHierarchy. Asks the server which callable(s) live at the cursor; the response feeds the subsequent Self::call_hierarchy_incoming_calls / Self::call_hierarchy_outgoing_calls request. Servers typically return a single-element vec for a position inside a function body; macros / overloads can produce multiple items. None means “no callable here”, which short-circuits the navigation.

Source

pub fn call_hierarchy_incoming_calls( &self, params: CallHierarchyIncomingCallsParams, token: CancellationToken, ) -> Pending<Option<Vec<CallHierarchyIncomingCall>>> ⓘ

4.5.a: callHierarchy/incomingCalls. Given a CallHierarchyItem from prepareCallHierarchy, returns the call sites that invoke it. Each CallHierarchyIncomingCall carries the caller item (from) plus the ranges inside the caller where the call appears (from_ranges).

Source

pub fn call_hierarchy_outgoing_calls( &self, params: CallHierarchyOutgoingCallsParams, token: CancellationToken, ) -> Pending<Option<Vec<CallHierarchyOutgoingCall>>> ⓘ

4.5.a: callHierarchy/outgoingCalls. Symmetric peer of incomingCalls; given a callable, returns the callables it invokes plus the call sites inside its own body (from_ranges on the caller’s text).

Source

pub fn prepare_type_hierarchy( &self, params: TypeHierarchyPrepareParams, token: CancellationToken, ) -> Pending<Option<Vec<TypeHierarchyItem>>> ⓘ

4.5.b: textDocument/prepareTypeHierarchy. Same preparation shape as prepareCallHierarchy but targets type relationships (super/sub-types). Used by :lsp-supertypes / :lsp-subtypes.

Source

pub fn type_hierarchy_supertypes( &self, params: TypeHierarchySupertypesParams, token: CancellationToken, ) -> Pending<Option<Vec<TypeHierarchyItem>>> ⓘ

4.5.b: typeHierarchy/supertypes. Returns the types the given item is a subtype of (e.g. trait supertraits, class superclasses).

Source

pub fn type_hierarchy_subtypes( &self, params: TypeHierarchySubtypesParams, token: CancellationToken, ) -> Pending<Option<Vec<TypeHierarchyItem>>> ⓘ

4.5.b: typeHierarchy/subtypes. Returns the types that subtype the given item (e.g. trait implementors, class subclasses).

Source

pub fn moniker( &self, params: MonikerParams, token: CancellationToken, ) -> Pending<Option<Vec<Moniker>>> ⓘ

4.5.g: textDocument/moniker. Returns the stable cross-project identifier(s) for the symbol at the cursor – e.g. SCIP / LSIF emit monikers so a build indexer can join symbols across repos. The response is Option<Vec<Moniker>>; each moniker has a scheme, identifier, optional kind, and unique level. :lsp-moniker ex-command surfaces the list as an echo.

4.5.c: textDocument/documentLink. Returns the hyperlink ranges inside the document (URLs, imports, file:// references emitted by certain LSPs). The host caches the response per (BufferId, doc_version) and consults the cache when gx is pressed in Normal mode – the first link whose range covers the cursor wins.

4.5.c: documentLink/resolve. Lazy-resolves a link that arrived without a target – the server fills it in on demand. gx triggers this when the cached link at the cursor lacks target AND the server advertises documentLinkProvider.resolveProvider. The resolved link is then followed in the same gesture.

Source

pub fn code_lens( &self, params: CodeLensParams, token: CancellationToken, ) -> Pending<Option<Vec<CodeLens>>> ⓘ

4.5.d: textDocument/codeLens. Returns above-line clickable annotations (run / debug / references etc.). The host caches per (BufferId, doc_version) and renders title-only items inline; clicking (:lsp-code-lens) fires the lens’s command via executeCommand.

Source

pub fn code_lens_resolve( &self, lens: CodeLens, token: CancellationToken, ) -> Pending<CodeLens> ⓘ

4.5.d: codeLens/resolve. Lazy-resolves a code lens whose command is missing – some servers return only the range + minimal title in the batched response and fill in the actual command on demand. Triggered when the user accepts a lens whose command is None.

Source

pub fn document_color( &self, params: DocumentColorParams, token: CancellationToken, ) -> Pending<Vec<ColorInformation>> ⓘ

4.5.e: textDocument/documentColor. Returns the color literals (hex / named) the server detected in the document, each with its range and resolved color (red/green/blue/alpha in [0.0, 1.0]). The host caches per (BufferId, doc_version) and feeds the cache to a future renderer swatch overlay; :lsp-color-presentation reads the cached entry at the cursor to drive the alternative-format picker.

Source

pub fn color_presentation( &self, params: ColorPresentationParams, token: CancellationToken, ) -> Pending<Vec<ColorPresentation>> ⓘ

4.5.e: textDocument/colorPresentation. Given a color + the range it covers, the server returns alternative presentations the user can replace the literal with (e.g. "#ff0000" -> "rgb(255, 0, 0)", "red"). :lsp-color-presentation opens these as a picker; accept splices the chosen text_edit (or label as a simple replace) at the literal’s range.

Source

pub fn linked_editing_range( &self, params: LinkedEditingRangeParams, token: CancellationToken, ) -> Pending<Option<LinkedEditingRanges>> ⓘ

4.5.f: textDocument/linkedEditingRange. Returns the ranges that should be edited in lockstep when the user types inside one of them (e.g. matching HTML/JSX tag pairs). Wire wrapper only – the multi-cursor shadow-edit machinery the feature needs is its own slice; see the matrix row’s strong-reason defer.

Source

pub fn inline_value( &self, params: InlineValueParams, token: CancellationToken, ) -> Pending<Option<Vec<InlineValue>>> ⓘ

4.5.h: textDocument/inlineValue. Returns the live values to render at each line during a debug session (e.g. n = 5, result = "ok"). Wire wrapper only – without a debug-adapter integration (DAP) the trigger surface that would render these is absent; see the matrix row’s strong-reason defer.

Source

pub fn completion( &self, params: CompletionParams, token: CancellationToken, ) -> Pending<Option<CompletionResponse>> ⓘ

textDocument/completion (DESIGN.md §5.4 / Phase 4.2.g). Returns either an array of items or an isIncomplete list the editor must re-query as the user types more. The completion pipeline (lattice-completion) registers a gen:lsp-completion source backed by this call.

Source

pub fn formatting( &self, params: DocumentFormattingParams, token: CancellationToken, ) -> Pending<Option<Vec<TextEdit>>> ⓘ

textDocument/formatting (DESIGN.md §5.4 / Phase 4.3). Whole-buffer formatter; the response is a Vec<TextEdit> the editor applies as a single undo unit. Single-server strategy per the architecture doc – highest-priority server with documentFormattingProvider advertised wins.

Source

pub fn range_formatting( &self, params: DocumentRangeFormattingParams, token: CancellationToken, ) -> Pending<Option<Vec<TextEdit>>> ⓘ

textDocument/rangeFormatting (Phase 4.3). Same shape as formatting but bounded to the supplied range – bound to the = operator on motions / objects / Visual selection.

Source

pub fn signature_help( &self, params: SignatureHelpParams, token: CancellationToken, ) -> Pending<Option<SignatureHelp>> ⓘ

textDocument/signatureHelp (Phase 4.3). Trigger-character driven (,, () when the server advertises the trigger. Response carries the active signature + parameter; renderer integration overlays a popup similar to hover.

Source

pub fn prepare_rename( &self, params: TextDocumentPositionParams, token: CancellationToken, ) -> Pending<Option<PrepareRenameResponse>> ⓘ

textDocument/prepareRename (Phase 4.3). Validates the cursor is on a renameable identifier and returns the placeholder + range. None means “the symbol can’t be renamed here” – the editor echoes and bails. Optional in the spec (servers may skip prepareRename and accept rename directly), so callers should treat None from prepare_rename as “fall through to rename”.

Source

pub fn rename( &self, params: RenameParams, token: CancellationToken, ) -> Pending<Option<WorkspaceEdit>> ⓘ

textDocument/rename (Phase 4.3). Renames the symbol under cursor across the workspace. Response is a WorkspaceEdit with per-file Vec<TextEdit>s; the editor applies all edits as a single undoable unit.

Source

pub fn will_save(&self, params: WillSaveTextDocumentParams) -> LspResult<()>

textDocument/willSave (Phase 4.3 – notification). Fired before the editor commits the buffer to disk. Servers use this to clean up state, finalise indexing, or prepare didSave-driven validation.

Source

pub fn will_save_wait_until( &self, params: WillSaveTextDocumentParams, token: CancellationToken, ) -> Pending<Option<Vec<TextEdit>>> ⓘ

textDocument/willSaveWaitUntil (Phase 4.3). Same trigger as will_save but request-shaped: server returns a Vec<TextEdit> to apply pre-save. format-on-save flows through here when the server advertises will_save_wait_until on its TextDocumentSyncOptions.save.

Source

pub fn did_save(&self, params: DidSaveTextDocumentParams) -> LspResult<()>

textDocument/didSave (Phase 4.3 – notification). Fired after a successful disk write. Carries the post-save text iff the server’s TextDocumentSaveRegistrationOptions.include_text is true.

Source

pub fn did_change_configuration( &self, params: DidChangeConfigurationParams, ) -> LspResult<()>

4.4.k: workspace/didChangeConfiguration (notification). Fan-out fires when any lsp.* typed option changes (via OptionChanged cascade). The notification’s settings carries the full lsp subtree from the merged config TOML; most servers ignore the inline payload and pull fresh values via workspace/configuration (the host’s drain serves from the same tree), but servers that read inline get the values too. Notification-only – no response, no cancellation token.

Source

pub fn did_change_watched_files( &self, params: DidChangeWatchedFilesParams, ) -> LspResult<()>

4.4.l: workspace/didChangeWatchedFiles (notification). Fan-out fires when the host’s file-watcher observes an fs event whose path matches a glob from this server’s client/registerCapability-issued DidChangeWatchedFilesRegistrationOptions. The host batches per-tick into one notification per server (the LSP spec allows multiple FileEvents in one payload); servers receive the events in arrival order. Notification-only – no response, no cancellation.

Source

pub fn will_create_files( &self, params: CreateFilesParams, cancel: CancellationToken, ) -> Pending<Option<WorkspaceEdit>> ⓘ

4.4.m: workspace/willCreateFiles (request). Pre-create hook – server MAY return a WorkspaceEdit the client applies BEFORE the actual file is created on disk (e.g. add an import to a sibling module). Callers must gate on Capabilities::supports_will_create_files + filter the URIs against the registration’s FileOperationFilters before issuing. The host pump (when wired) blocks the create path on the response; timeouts skip the edits and proceed.

Source

pub fn did_create_files(&self, params: CreateFilesParams) -> LspResult<()>

4.4.m: workspace/didCreateFiles (notification). Post-create fan-out. The wire wrapper is straight-line; trigger discipline (when to fire) lives in the host save / create paths.

Source

pub fn will_rename_files( &self, params: RenameFilesParams, cancel: CancellationToken, ) -> Pending<Option<WorkspaceEdit>> ⓘ

4.4.m: workspace/willRenameFiles (request). Same response shape as willCreateFiles. Triggered when the user renames a file in-place (:saveas follow-up that removes the original); server returns edits to keep imports / references in sync with the new path.

Source

pub fn did_rename_files(&self, params: RenameFilesParams) -> LspResult<()>

4.4.m: workspace/didRenameFiles (notification).

Source

pub fn will_delete_files( &self, params: DeleteFilesParams, cancel: CancellationToken, ) -> Pending<Option<WorkspaceEdit>> ⓘ

4.4.m: workspace/willDeleteFiles (request). Server returns edits to clean up references before the delete.

Source

pub fn did_delete_files(&self, params: DeleteFilesParams) -> LspResult<()>

4.4.m: workspace/didDeleteFiles (notification).

Source

pub fn code_action( &self, params: CodeActionParams, token: CancellationToken, ) -> Pending<Option<CodeActionResponse>> ⓘ

textDocument/codeAction (Phase 4.3). Returns the list of quick fixes / refactors / source actions available for the supplied range. Each item carries either an inline edit (apply directly), a command (route through executeCommand), or both. Items with neither need codeAction/resolve to fill in the missing edit.

Source

pub fn code_action_resolve( &self, action: CodeAction, token: CancellationToken, ) -> Pending<CodeAction> ⓘ

codeAction/resolve (Phase 4.3). Lazy-resolve a codeAction that arrived without edit. Servers that advertise codeActionProvider.resolveProvider may return action stubs (label + kind only) and fill in edit here, on demand. Cheaper than computing every edit upfront.

Source

pub fn execute_command( &self, params: ExecuteCommandParams, token: CancellationToken, ) -> Pending<Option<Value>> ⓘ

workspace/executeCommand (Phase 4.3). Run a server- registered command identified by string id. Used by codeAction items that carry a command rather than an inline edit. Response shape varies per command – servers usually return null + side-effect via workspace/applyEdit.

Source

pub fn on_type_formatting( &self, params: DocumentOnTypeFormattingParams, token: CancellationToken, ) -> Pending<Option<Vec<TextEdit>>> ⓘ

textDocument/onTypeFormatting (Phase 4.3). Trigger- character driven formatting that adjusts surrounding whitespace / indentation as the user types (commonly fires on ;, }, \n for C-family). Returns the same Vec<TextEdit> shape as the other formatting flavours.

Source

pub fn document_highlight( &self, params: DocumentHighlightParams, token: CancellationToken, ) -> Pending<Option<Vec<DocumentHighlight>>> ⓘ

4.4.e: textDocument/documentHighlight. Returns the references to the symbol at the cursor inside the current document; each entry carries an optional kind (Text / Read / Write) so the overlay can paint reads / writes differently. Response is Vec<DocumentHighlight> or null when the cursor isn’t on a known symbol.

Source

pub fn selection_range( &self, params: SelectionRangeParams, token: CancellationToken, ) -> Pending<Option<Vec<SelectionRange>>> ⓘ

4.4.e: textDocument/selectionRange. Given a slice of positions (almost always one cursor position), the server returns the structural ranges that surround each position, walking outward (token → expression → statement → block → function → module). The operator-side expand-region / shrink-region consumes the linked list.

Source

pub fn folding_range( &self, params: FoldingRangeParams, token: CancellationToken, ) -> Pending<Option<Vec<FoldingRange>>> ⓘ

4.4.f: textDocument/foldingRange. Returns line-based fold extents (with optional character columns + kind tag like comment / imports / region). The host’s per-tick pump refreshes the cache when the document version bumps; :set foldmethod=lsp reads from the cache.

Source

pub fn inlay_hint( &self, params: InlayHintParams, token: CancellationToken, ) -> Pending<Option<Vec<InlayHint>>> ⓘ

4.4.g: textDocument/inlayHint. Returns inline virtual-text annotations (type hints, parameter names, etc.) over the requested range. Each hint carries its position, a label (single string or composite Vec<InlayHintLabelPart>), and optional kind / padding / tooltip fields. The host caches the response per buffer-version and the renderer splices each hint into the line span list.

Source

pub fn inlay_hint_resolve( &self, hint: InlayHint, token: CancellationToken, ) -> Pending<InlayHint> ⓘ

4.4.g follow-up: inlayHint/resolve. Lazy-resolves a single inlay hint – the server populates the tooltip and text_edits fields it skipped on the initial batched response. Servers gate this behind the InlayHintOptions.resolve_provider capability; callers must check crate::Capabilities::supports_inlay_hint_resolve before issuing. The wrapper ships ahead of the interaction UX (no gesture is wired to fire it today – see lsp-features.md for the deferral rationale); this lets future work plug a trigger into a stable surface.

Source

pub fn semantic_tokens_full( &self, params: SemanticTokensParams, token: CancellationToken, ) -> Pending<Option<SemanticTokensResult>> ⓘ

4.4.h: textDocument/semanticTokens/full. Returns the whole-buffer semantic token list in the LSP relative-position varint encoding (5 u32s per token: deltaLine, deltaStart, length, tokenType, modifiers bitfield). The host decodes against the server’s SemanticTokensLegend (cached at attach time via crate::Capabilities::semantic_token_types / semantic_token_modifiers). Wrapped response variant Tokens carries data: Vec<u32> plus an optional result_id for the 4.4.i delta path.

Source

pub fn semantic_tokens_full_delta( &self, params: SemanticTokensDeltaParams, token: CancellationToken, ) -> Pending<Option<SemanticTokensFullDeltaResult>> ⓘ

4.4.i: textDocument/semanticTokens/full/delta. Sends the previous response’s result_id; server either returns a new full token list (Tokens variant) when it can’t compute a delta cheaply, or a list of edit operations (TokensDelta) the host applies to the cached raw token vec. Edit shape: SemanticTokensEdit { start, delete_count, data } where start is the index into the previous flat token vec, delete_count is how many SemanticToken entries to remove, and data is what to splice in. The host re-decodes the spliced vec into absolute positions.

Source

pub fn semantic_tokens_range( &self, params: SemanticTokensRangeParams, token: CancellationToken, ) -> Pending<Option<SemanticTokensRangeResult>> ⓘ

4.4.i: textDocument/semanticTokens/range. Viewport- bounded request – the host can issue this for very large files to skip decoding tokens outside the visible window. Returns a plain SemanticTokens (no Delta variant for the range flavour). Exposed as a typed wrapper today; the v1 pump uses full/delta. Viewport-aware fetching can switch over in a follow-up without re-touching the wire path.

Source

pub fn document_diagnostic( &self, params: DocumentDiagnosticParams, token: CancellationToken, ) -> Pending<DocumentDiagnosticReportResult> ⓘ

4.4.j: textDocument/diagnostic. Pull-based diagnostics (LSP 3.17). The server returns either a Full report (entire diagnostics list for the URI, plus optional result_id for the next delta) or an Unchanged report (“no diagnostics moved since the previous result_id”). The host caches the result_id per buffer-version and threads it back in DocumentDiagnosticParams.previous_result_id so the server can answer Unchanged cheaply. Used when a server prefers pull over push, or alongside push for servers that support both.

Source

pub fn workspace_diagnostic( &self, params: WorkspaceDiagnosticParams, token: CancellationToken, ) -> Pending<WorkspaceDiagnosticReportResult> ⓘ

4.4.j: workspace/diagnostic. Workspace-wide pull – returns reports for every URI the server tracks diagnostics for, even ones the client hasn’t opened. Wrapper ships ahead of the host pump (strong-reason deferred; the per-document pump already covers every open buffer’s diagnostics, and the closed-file workspace pull is niche – see lsp-features.md). The callable exists so future workspace-view rework has a stable surface.

Trait Implementations§

Source§

impl Clone for ServerHandle

Source§

fn clone(&self) -> ServerHandle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ServerHandle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more