pub trait LspProvider:
Send
+ Sync
+ Debug {
// Required methods
fn ensure_started_background<'a>(
&'a self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>;
fn ensure_ready<'a>(
&'a self,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'a>>;
fn drain_diagnostics<'a>(
&'a self,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Option<DiagnosticsSummary>> + Send + 'a>>;
fn read_diagnostics<'a>(
&'a self,
paths: &'a [PathBuf],
) -> Pin<Box<dyn Future<Output = Vec<FileDiagnosticEntry>> + Send + 'a>>;
fn execute_action<'a>(
&'a self,
action: &'a LspAction,
) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'a>>;
// Provided method
fn notify_file_changed<'a>(
&'a self,
_path: &'a Path,
_content: &'a str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>> { ... }
}Expand description
Required Methods§
Sourcefn ensure_started_background<'a>(
&'a self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>
fn ensure_started_background<'a>( &'a self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>
Kick off background initialisation (servers start but ensure_ready
isn’t awaited). Idempotent.
Sourcefn ensure_ready<'a>(
&'a self,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'a>>
fn ensure_ready<'a>( &'a self, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'a>>
Block until at least the configured LSP servers have finished their
initialize handshake (or the operation times out per the
provider’s internal budget).
Sourcefn drain_diagnostics<'a>(
&'a self,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Option<DiagnosticsSummary>> + Send + 'a>>
fn drain_diagnostics<'a>( &'a self, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Option<DiagnosticsSummary>> + Send + 'a>>
Drain the most recent batch of diagnostics that arrived via
textDocument/publishDiagnostics. Returns None when nothing
fresh has arrived within timeout.
Sourcefn read_diagnostics<'a>(
&'a self,
paths: &'a [PathBuf],
) -> Pin<Box<dyn Future<Output = Vec<FileDiagnosticEntry>> + Send + 'a>>
fn read_diagnostics<'a>( &'a self, paths: &'a [PathBuf], ) -> Pin<Box<dyn Future<Output = Vec<FileDiagnosticEntry>> + Send + 'a>>
Read the most recent cached diagnostics for the given file paths (zero-copy snapshot — no waiting). Paths that have no fresh diagnostics are omitted from the returned vec.
Provided Methods§
Sourcefn notify_file_changed<'a>(
&'a self,
_path: &'a Path,
_content: &'a str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>
fn notify_file_changed<'a>( &'a self, _path: &'a Path, _content: &'a str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>
Notify the LSP manager that the contents of path changed. The
manager is responsible for forwarding a workspace/didChange to
every server that owns the file. Default implementation is a no-op
so lightweight providers (e.g. test stubs) don’t have to wire it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".