@@ -372,6 +372,7 @@ impl Client {
372
372
Some ( OneOf :: Left ( true ) | OneOf :: Right ( _) )
373
373
) ,
374
374
LanguageServerFeature :: Diagnostics => true , // there's no extra server capability
375
+ LanguageServerFeature :: PullDiagnostics => capabilities. diagnostic_provider . is_some ( ) ,
375
376
LanguageServerFeature :: RenameSymbol => matches ! (
376
377
capabilities. rename_provider,
377
378
Some ( OneOf :: Left ( true ) ) | Some ( OneOf :: Right ( _) )
@@ -602,6 +603,9 @@ impl Client {
602
603
did_rename : Some ( true ) ,
603
604
..Default :: default ( )
604
605
} ) ,
606
+ diagnostic : Some ( lsp:: DiagnosticWorkspaceClientCapabilities {
607
+ refresh_support : Some ( true ) ,
608
+ } ) ,
605
609
..Default :: default ( )
606
610
} ) ,
607
611
text_document : Some ( lsp:: TextDocumentClientCapabilities {
@@ -679,6 +683,10 @@ impl Client {
679
683
} ) ,
680
684
..Default :: default ( )
681
685
} ) ,
686
+ diagnostic : Some ( lsp:: DiagnosticClientCapabilities {
687
+ dynamic_registration : Some ( false ) ,
688
+ related_document_support : Some ( true ) ,
689
+ } ) ,
682
690
publish_diagnostics : Some ( lsp:: PublishDiagnosticsClientCapabilities {
683
691
version_support : Some ( true ) ,
684
692
tag_support : Some ( lsp:: TagSupport {
@@ -1229,6 +1237,32 @@ impl Client {
1229
1237
Some ( self . call :: < lsp:: request:: RangeFormatting > ( params) )
1230
1238
}
1231
1239
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
+
1232
1266
pub fn text_document_document_highlight (
1233
1267
& self ,
1234
1268
text_document : lsp:: TextDocumentIdentifier ,
0 commit comments