@@ -141,11 +141,18 @@ def __init__(self, protocol: LanguageServerProtocol) -> None:
141
141
142
142
self .refresh_task : Optional [asyncio .Task [Any ]] = None
143
143
144
+ self .client_supports_pull = False
145
+
144
146
async def initialized (self , sender : Any ) -> None :
145
147
self ._ensure_diagnostics_thread_started ()
146
148
147
149
self ._workspace_diagnostics_task = create_sub_task (self .run_workspace_diagnostics (), loop = self .diagnostics_loop )
148
150
151
+ if not self .client_supports_pull :
152
+ self .parent .documents .did_open .add (self .update_document_diagnostics )
153
+ self .parent .documents .did_change .add (self .update_document_diagnostics )
154
+ self .parent .documents .did_save .add (self .update_document_diagnostics )
155
+
149
156
def extend_capabilities (self , capabilities : ServerCapabilities ) -> None :
150
157
if (
151
158
self .parent .client_capabilities is not None
@@ -158,6 +165,7 @@ def extend_capabilities(self, capabilities: ServerCapabilities) -> None:
158
165
identifier = f"robotcodelsp_{ uuid .uuid4 ()} " ,
159
166
work_done_progress = True ,
160
167
)
168
+ self .client_supports_pull = True
161
169
162
170
@property
163
171
def diagnostics_loop (self ) -> asyncio .AbstractEventLoop :
@@ -486,6 +494,9 @@ def publish_diagnostics(self, document: TextDocument, diagnostics: List[Diagnost
486
494
),
487
495
)
488
496
497
+ async def update_document_diagnostics (self , sender : Any , document : TextDocument ) -> None :
498
+ self .create_document_diagnostics_task (document , True )
499
+
489
500
@rpc_method (name = "textDocument/diagnostic" , param_type = DocumentDiagnosticParams )
490
501
@threaded ()
491
502
async def _text_document_diagnostic (
0 commit comments