@@ -372,6 +372,7 @@ impl Client {
372372 Some ( OneOf :: Left ( true ) | OneOf :: Right ( _) )
373373 ) ,
374374 LanguageServerFeature :: Diagnostics => true , // there's no extra server capability
375+ LanguageServerFeature :: PullDiagnostics => capabilities. diagnostic_provider . is_some ( ) ,
375376 LanguageServerFeature :: RenameSymbol => matches ! (
376377 capabilities. rename_provider,
377378 Some ( OneOf :: Left ( true ) ) | Some ( OneOf :: Right ( _) )
@@ -602,6 +603,9 @@ impl Client {
602603 did_rename : Some ( true ) ,
603604 ..Default :: default ( )
604605 } ) ,
606+ diagnostic : Some ( lsp:: DiagnosticWorkspaceClientCapabilities {
607+ refresh_support : Some ( true ) ,
608+ } ) ,
605609 ..Default :: default ( )
606610 } ) ,
607611 text_document : Some ( lsp:: TextDocumentClientCapabilities {
@@ -679,6 +683,10 @@ impl Client {
679683 } ) ,
680684 ..Default :: default ( )
681685 } ) ,
686+ diagnostic : Some ( lsp:: DiagnosticClientCapabilities {
687+ dynamic_registration : Some ( false ) ,
688+ related_document_support : Some ( true ) ,
689+ } ) ,
682690 publish_diagnostics : Some ( lsp:: PublishDiagnosticsClientCapabilities {
683691 version_support : Some ( true ) ,
684692 tag_support : Some ( lsp:: TagSupport {
@@ -1229,6 +1237,32 @@ impl Client {
12291237 Some ( self . call :: < lsp:: request:: RangeFormatting > ( params) )
12301238 }
12311239
1240+ pub fn text_document_diagnostic (
1241+ & self ,
1242+ text_document : lsp:: TextDocumentIdentifier ,
1243+ previous_result_id : Option < String > ,
1244+ ) -> Option < impl Future < Output = Result < lsp:: DocumentDiagnosticReportResult > > > {
1245+ let capabilities = self . capabilities ( ) ;
1246+
1247+ // Return early if the server does not support pull diagnostic.
1248+ let identifier = match capabilities. diagnostic_provider . as_ref ( ) ? {
1249+ lsp:: DiagnosticServerCapabilities :: Options ( cap) => cap. identifier . clone ( ) ,
1250+ lsp:: DiagnosticServerCapabilities :: RegistrationOptions ( cap) => {
1251+ cap. diagnostic_options . identifier . clone ( )
1252+ }
1253+ } ;
1254+
1255+ let params = lsp:: DocumentDiagnosticParams {
1256+ text_document,
1257+ identifier,
1258+ previous_result_id,
1259+ work_done_progress_params : lsp:: WorkDoneProgressParams :: default ( ) ,
1260+ partial_result_params : lsp:: PartialResultParams :: default ( ) ,
1261+ } ;
1262+
1263+ Some ( self . call :: < lsp:: request:: DocumentDiagnosticRequest > ( params) )
1264+ }
1265+
12321266 pub fn text_document_document_highlight (
12331267 & self ,
12341268 text_document : lsp:: TextDocumentIdentifier ,
0 commit comments