@@ -215,10 +215,13 @@ def hover(self, doc_uri, position):
215
215
return self ._hook ('pyls_hover' , doc_uri , position = position ) or {'contents' : '' }
216
216
217
217
@_utils .debounce (LINT_DEBOUNCE_S , keyed_by = 'doc_uri' )
218
- def lint (self , doc_uri ):
218
+ def lint (self , doc_uri , is_saved ):
219
219
# Since we're debounced, the document may no longer be open
220
220
if doc_uri in self .workspace .documents :
221
- self .workspace .publish_diagnostics (doc_uri , flatten (self ._hook ('pyls_lint' , doc_uri )))
221
+ self .workspace .publish_diagnostics (
222
+ doc_uri ,
223
+ flatten (self ._hook ('pyls_lint' , doc_uri , is_saved = is_saved ))
224
+ )
222
225
223
226
def references (self , doc_uri , position , exclude_declaration ):
224
227
return flatten (self ._hook (
@@ -238,7 +241,7 @@ def m_text_document__did_close(self, textDocument=None, **_kwargs):
238
241
def m_text_document__did_open (self , textDocument = None , ** _kwargs ):
239
242
self .workspace .put_document (textDocument ['uri' ], textDocument ['text' ], version = textDocument .get ('version' ))
240
243
self ._hook ('pyls_document_did_open' , textDocument ['uri' ])
241
- self .lint (textDocument ['uri' ])
244
+ self .lint (textDocument ['uri' ], is_saved = False )
242
245
243
246
def m_text_document__did_change (self , contentChanges = None , textDocument = None , ** _kwargs ):
244
247
for change in contentChanges :
@@ -247,10 +250,10 @@ def m_text_document__did_change(self, contentChanges=None, textDocument=None, **
247
250
change ,
248
251
version = textDocument .get ('version' )
249
252
)
250
- self .lint (textDocument ['uri' ])
253
+ self .lint (textDocument ['uri' ], is_saved = False )
251
254
252
255
def m_text_document__did_save (self , textDocument = None , ** _kwargs ):
253
- self .lint (textDocument ['uri' ])
256
+ self .lint (textDocument ['uri' ], is_saved = True )
254
257
255
258
def m_text_document__code_action (self , textDocument = None , range = None , context = None , ** _kwargs ):
256
259
return self .code_actions (textDocument ['uri' ], range , context )
@@ -294,7 +297,7 @@ def m_text_document__signature_help(self, textDocument=None, position=None, **_k
294
297
def m_workspace__did_change_configuration (self , settings = None ):
295
298
self .config .update ((settings or {}).get ('pyls' , {}))
296
299
for doc_uri in self .workspace .documents :
297
- self .lint (doc_uri )
300
+ self .lint (doc_uri , is_saved = False )
298
301
299
302
def m_workspace__did_change_watched_files (self , changes = None , ** _kwargs ):
300
303
changed_py_files = set (d ['uri' ] for d in changes if d ['uri' ].endswith (PYTHON_FILE_EXTENSIONS ))
@@ -306,7 +309,7 @@ def m_workspace__did_change_watched_files(self, changes=None, **_kwargs):
306
309
for doc_uri in self .workspace .documents :
307
310
# Changes in doc_uri are already handled by m_text_document__did_save
308
311
if doc_uri not in changed_py_files :
309
- self .lint (doc_uri )
312
+ self .lint (doc_uri , is_saved = False )
310
313
311
314
def m_workspace__execute_command (self , command = None , arguments = None ):
312
315
return self .execute_command (command , arguments )
0 commit comments