pub trait RulePackServer {
Show 26 methods
// Required methods
fn rule_packs(&self) -> &ValidatedRulePackSet;
fn grammar(&self) -> Language;
fn server_name(&self) -> &'static str;
fn client(&self) -> &Client;
fn adapter(&self) -> &AutoLspAdapter;
// Provided methods
fn cross_file_rules(&self) -> &[CrossFileRule] { ... }
fn workspace_index(&self) -> Option<&WorkspaceIndex> { ... }
fn spc_monitor(&self) -> Option<&Mutex<SpcMonitor>> { ... }
fn latency_trackers(
&self,
) -> Option<&Arc<DashMap<String, RuleLatencyTracker>>> { ... }
fn rule_circuit_breaker(&self) -> Option<&Arc<Mutex<CircuitBreaker>>> { ... }
fn server_capabilities(&self) -> ServerCapabilities { ... }
fn build_initialize_result(&self) -> InitializeResult { ... }
async fn handle_did_open(&self, params: DidOpenTextDocumentParams) { ... }
async fn handle_did_change(&self, params: DidChangeTextDocumentParams) { ... }
fn handle_did_close(&self, params: DidCloseTextDocumentParams) { ... }
fn scan_uri_classified(
&self,
uri: &DocumentUri,
content: &str,
) -> ClassifiedFindings { ... }
fn scan_uri(&self, uri: &DocumentUri, content: &str) -> Vec<Finding> ⓘ { ... }
async fn publish_findings_classified(&self, uri: DocumentUri, content: &str) { ... }
async fn publish_findings(&self, uri: DocumentUri, content: &str) { ... }
fn pull_document_diagnostics(
&self,
uri: &DocumentUri,
) -> DocumentDiagnosticReportResult { ... }
fn conformance_for_content(
&self,
uri: &DocumentUri,
content: &str,
) -> ConformanceVector { ... }
fn snapshot_conformance(&self, uri: &DocumentUri) -> ConformanceVector { ... }
fn workspace_conformance(&self) -> ConformanceVector { ... }
fn evaluate_cross_file_rules(&self) -> Option<Vec<CrossFileViolation>> { ... }
fn cross_file_violations_as_diagnostics(
&self,
violations: &[CrossFileViolation],
) -> HashMap<String, Vec<Diagnostic>> { ... }
async fn publish_cross_file_diagnostics(&self) { ... }
}Expand description
The bridge between lsp-max’s LanguageServer machinery and a set of
loaded RulePacks.
Required Methods§
Sourcefn rule_packs(&self) -> &ValidatedRulePackSet
fn rule_packs(&self) -> &ValidatedRulePackSet
The rule packs this server enforces, pre-validated for conflicts.
Sourcefn server_name(&self) -> &'static str
fn server_name(&self) -> &'static str
A stable, human-readable server identifier.
Sourcefn adapter(&self) -> &AutoLspAdapter
fn adapter(&self) -> &AutoLspAdapter
The AutoLspAdapter that owns the incremental document store.
Provided Methods§
Sourcefn cross_file_rules(&self) -> &[CrossFileRule]
fn cross_file_rules(&self) -> &[CrossFileRule]
Optional cross-file rules. Default: empty.
Sourcefn workspace_index(&self) -> Option<&WorkspaceIndex>
fn workspace_index(&self) -> Option<&WorkspaceIndex>
The shared workspace index. Servers that want cross-file diagnostics
must hold a WorkspaceIndex field and return it here.
Sourcefn spc_monitor(&self) -> Option<&Mutex<SpcMonitor>>
fn spc_monitor(&self) -> Option<&Mutex<SpcMonitor>>
Optional SPC monitor for scan-latency anomaly detection.
Override to return Some(&self.spc_monitor) to enable Western Electric rule checks.
Sourcefn latency_trackers(&self) -> Option<&Arc<DashMap<String, RuleLatencyTracker>>>
fn latency_trackers(&self) -> Option<&Arc<DashMap<String, RuleLatencyTracker>>>
Optional per-rule latency tracker map for dynamic EvalBudget reclassification.
Sourcefn rule_circuit_breaker(&self) -> Option<&Arc<Mutex<CircuitBreaker>>>
fn rule_circuit_breaker(&self) -> Option<&Arc<Mutex<CircuitBreaker>>>
Optional circuit breaker protecting the rule-evaluation loop.
Sourcefn server_capabilities(&self) -> ServerCapabilities
fn server_capabilities(&self) -> ServerCapabilities
Build the ServerCapabilities block advertised during initialize.
When cross-file rules are present, inter_file_dependencies and
workspace_diagnostics are set to true so editors know to request
workspace-level diagnostic reports.
Sourcefn build_initialize_result(&self) -> InitializeResult
fn build_initialize_result(&self) -> InitializeResult
Construct the InitializeResult this server returns.
Sourceasync fn handle_did_open(&self, params: DidOpenTextDocumentParams)
async fn handle_did_open(&self, params: DidOpenTextDocumentParams)
Handle textDocument/didOpen: index the document, parse incrementally,
and publish diagnostics from all sync-budget rule packs.
Background-budget rules are dispatched as Tokio tasks.
Sourceasync fn handle_did_change(&self, params: DidChangeTextDocumentParams)
async fn handle_did_change(&self, params: DidChangeTextDocumentParams)
Handle textDocument/didChange: update the index and re-run sync rules.
Sourcefn handle_did_close(&self, params: DidCloseTextDocumentParams)
fn handle_did_close(&self, params: DidCloseTextDocumentParams)
Handle textDocument/didClose: evict from adapter and index.
Sourcefn scan_uri_classified(
&self,
uri: &DocumentUri,
content: &str,
) -> ClassifiedFindings
fn scan_uri_classified( &self, uri: &DocumentUri, content: &str, ) -> ClassifiedFindings
Scan content against every rule in every loaded pack, applying the
EvalBudget classification.
Returns (sync_findings, background_findings).
Sourcefn scan_uri(&self, uri: &DocumentUri, content: &str) -> Vec<Finding> ⓘ
fn scan_uri(&self, uri: &DocumentUri, content: &str) -> Vec<Finding> ⓘ
Scan content against all rules (ignoring budget classification).
Sourceasync fn publish_findings_classified(&self, uri: DocumentUri, content: &str)
async fn publish_findings_classified(&self, uri: DocumentUri, content: &str)
Run scan_uri and push the resulting LSP diagnostics to the client,
respecting EvalBudget. Sync findings are published immediately.
Background findings are published from the calling task (Tokio will
handle concurrency at the server level).
Sourceasync fn publish_findings(&self, uri: DocumentUri, content: &str)
async fn publish_findings(&self, uri: DocumentUri, content: &str)
Run scan_uri and push the resulting LSP diagnostics to the client.
Sourcefn pull_document_diagnostics(
&self,
uri: &DocumentUri,
) -> DocumentDiagnosticReportResult
fn pull_document_diagnostics( &self, uri: &DocumentUri, ) -> DocumentDiagnosticReportResult
Build a DocumentDiagnosticReportResult for the pull-diagnostics endpoint.
Sourcefn conformance_for_content(
&self,
uri: &DocumentUri,
content: &str,
) -> ConformanceVector
fn conformance_for_content( &self, uri: &DocumentUri, content: &str, ) -> ConformanceVector
Return the per-document ConformanceVector derived from rule-pack findings.
Sourcefn snapshot_conformance(&self, uri: &DocumentUri) -> ConformanceVector
fn snapshot_conformance(&self, uri: &DocumentUri) -> ConformanceVector
Return a ConformanceVector for the document currently held in the
incremental adapter store, falling back to all-unknown.
Sourcefn workspace_conformance(&self) -> ConformanceVector
fn workspace_conformance(&self) -> ConformanceVector
Return the workspace-level ConformanceVector aggregated across all
indexed documents.
This is the game-changer: a single vector showing admitted/refused/unknown axes across the entire workspace. No other LSP provides this.
Sourcefn evaluate_cross_file_rules(&self) -> Option<Vec<CrossFileViolation>>
fn evaluate_cross_file_rules(&self) -> Option<Vec<CrossFileViolation>>
Evaluate all cross-file rules and return workspace violations.
Returns None if no workspace index is configured.
Sourcefn cross_file_violations_as_diagnostics(
&self,
violations: &[CrossFileViolation],
) -> HashMap<String, Vec<Diagnostic>>
fn cross_file_violations_as_diagnostics( &self, violations: &[CrossFileViolation], ) -> HashMap<String, Vec<Diagnostic>>
Convert cross-file violations to LSP diagnostics grouped by source URI.
Sourceasync fn publish_cross_file_diagnostics(&self)
async fn publish_cross_file_diagnostics(&self)
Run cross-file rule evaluation and publish diagnostics per-file.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".