Closed xhyrom closed 1 month ago
When i'm trying to implement diagnostic or workspace_diagnostic method, I'm receiving this error:
diagnostic
workspace_diagnostic
error[E0053]: method `diagnostic` has an incompatible type for trait --> lsp/src/main.rs:72:1 | 72 | #[tower_lsp::async_trait] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected `Result<DocumentDiagnosticReportResult, ...>`, found `()` | help: change the output type to match the trait: `Pin<Box<(dyn Future<Output = Result<DocumentDiagnosticReportResult, tower_lsp::jsonrpc::Error>> + Send + 'async_trait)>>` | = note: expected signature `fn(&'life0 Backend, tower_lsp::lsp_types::DocumentDiagnosticParams) -> Pin<Box<(dyn Future<Output = Result<DocumentDiagnosticReportResult, tower_lsp::jsonrpc::Error>> + Send + 'async_trait)>>` found signature `fn(&'life0 Backend, tower_lsp::lsp_types::DocumentDiagnosticParams) -> Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>` = note: this error originates in the attribute macro `tower_lsp::async_trait` (in Nightly builds, run with -Z macro-backtrace for more info)
#[tower_lsp::async_trait] impl LanguageServer for Backend { async fn initialize(&self, params: InitializeParams) -> Result<InitializeResult> { Ok(InitializeResult::default()) } async fn initialized(&self, _: InitializedParams) { self.client .log_message( MessageType::INFO, "server initialized!", ) .await; } async fn shutdown(&self) -> Result<()> { Ok(()) } async fn diagnostic(&self, params: DocumentDiagnosticParams) {} }
there's return type, sorry
When i'm trying to implement
diagnostic
orworkspace_diagnostic
method, I'm receiving this error: