Skip to content
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

Fix Python diagnostics not being cleared on document close #6141

Open
wants to merge 1 commit into
base: 5739-fix-lsp-methods-not-searching-user-namespace
Choose a base branch
from

Conversation

seeM
Copy link
Contributor

@seeM seeM commented Jan 28, 2025

Addresses #3905.

Release Notes

New Features

  • N/A

Bug Fixes

QA Notes

See the linked issue.

@seeM seeM changed the base branch from main to 5739-fix-lsp-methods-not-searching-user-namespace January 28, 2025 14:27
Copy link

github-actions bot commented Jan 28, 2025

E2E Tests 🚀
This PR will run tests tagged with: @:critical

readme  valid tags

@seeM seeM force-pushed the 3905-clear-diagnostics-on-close branch from 70947af to 3cf8840 Compare January 28, 2025 15:44
Copy link
Contributor

@austin3dickey austin3dickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like a nice simplification!

# This happens when a cell's language is changed from python e.g. to raw,
# see: https://github.com/posit-dev/positron/issues/4160.
if params.text_document.uri.startswith(_VSCODE_NOTEBOOK_CELL_SCHEME):
return _clear_diagnostics_debounced(server, params.text_document.uri)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is reverting some of #5950?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just empirically testing, it looks like Problems is still working as expected swapping between raw/Python/closing a notebook 💯

Copy link
Contributor Author

@seeM seeM Jan 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, this clears diagnostics when any document is closed instead of just notebook cells, although I've kept the test from #5950. It should probably have been that way from the beginning (see #6141 (comment)).


with patch.object(server, "publish_diagnostics") as mock:
params = DidCloseTextDocumentParams(TextDocumentIdentifier(text_document.uri))
positron_did_close_diagnostics(server, params)

# Wait for the diagnostics to be published
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not need this wait anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. I checked upstream and they clear diagnostics immediately on document close. We should have always done that, but I assume not doing that was a mistake when we first set this up.

@seeM
Copy link
Contributor Author

seeM commented Jan 29, 2025

Will merge this after #6140.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants