We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
workspace/publishDiagnostics
1 parent cf3cea1 commit 9b79576Copy full SHA for 9b79576
pylsp/python_lsp.py
@@ -442,13 +442,13 @@ def lint(self, doc_uri, is_saved):
442
workspace = self._match_uri_to_workspace(doc_uri)
443
document_object = workspace.documents.get(doc_uri, None)
444
if isinstance(document_object, Document):
445
- self._lint_text_document(doc_uri, workspace, is_saved=is_saved)
+ self._lint_text_document(doc_uri, workspace, is_saved, document_object.version)
446
elif isinstance(document_object, Notebook):
447
self._lint_notebook_document(document_object, workspace)
448
449
- def _lint_text_document(self, doc_uri, workspace, is_saved):
+ def _lint_text_document(self, doc_uri, workspace, is_saved, doc_version=None):
450
workspace.publish_diagnostics(
451
- doc_uri, flatten(self._hook("pylsp_lint", doc_uri, is_saved=is_saved))
+ doc_uri, flatten(self._hook("pylsp_lint", doc_uri, is_saved=is_saved)), doc_version,
452
)
453
454
def _lint_notebook_document(self, notebook_document, workspace):
pylsp/workspace.py
@@ -176,10 +176,18 @@ def update_config(self, settings):
176
def apply_edit(self, edit):
177
return self._endpoint.request(self.M_APPLY_EDIT, {"edit": edit})
178
179
- def publish_diagnostics(self, doc_uri, diagnostics):
+ def publish_diagnostics(self, doc_uri, diagnostics, doc_version=None):
180
+ params = {
181
+ "uri": doc_uri,
182
+ "diagnostics": diagnostics,
183
+ }
184
+
185
+ if doc_version:
186
+ params["version"] = doc_version
187
188
self._endpoint.notify(
189
self.M_PUBLISH_DIAGNOSTICS,
- params={"uri": doc_uri, "diagnostics": diagnostics},
190
+ params=params,
191
192
193
@contextmanager
0 commit comments