Skip to content

Report document version back in diagnostics hook #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pyls/python_ls.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,12 @@ def hover(self, doc_uri, position):
def lint(self, doc_uri, is_saved):
# Since we're debounced, the document may no longer be open
workspace = self._match_uri_to_workspace(doc_uri)
textDocument = workspace.get_maybe_document(doc_uri)
if doc_uri in workspace.documents:
workspace.publish_diagnostics(
doc_uri,
flatten(self._hook('pyls_lint', doc_uri, is_saved=is_saved))
flatten(self._hook('pyls_lint', doc_uri, is_saved=is_saved)),
textDocument.version if textDocument else None
)

def references(self, doc_uri, position, exclude_declaration):
Expand Down
8 changes: 6 additions & 2 deletions pyls/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,12 @@ def update_config(self, settings):
def apply_edit(self, edit):
return self._endpoint.request(self.M_APPLY_EDIT, {'edit': edit})

def publish_diagnostics(self, doc_uri, diagnostics):
self._endpoint.notify(self.M_PUBLISH_DIAGNOSTICS, params={'uri': doc_uri, 'diagnostics': diagnostics})
def publish_diagnostics(self, doc_uri, diagnostics, version):
self._endpoint.notify(self.M_PUBLISH_DIAGNOSTICS, params={
'uri': doc_uri,
'diagnostics': diagnostics,
'version': version
})

def show_message(self, message, msg_type=lsp.MessageType.Info):
self._endpoint.notify(self.M_SHOW_MESSAGE, params={'type': msg_type, 'message': message})
Expand Down