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 diagnostic line numbers #98

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

freebird-2
Copy link

@freebird-2 freebird-2 commented Dec 8, 2024

fixes #97

The plugin reports wrong line numbers for diagnostics in some cases, due to faulty handling of line endings. The fix is to write the text in binary mode, which prevents any line-ending translation by Python.

Please see the issue description for more details.

@freebird-2
Copy link
Author

freebird-2 commented Dec 8, 2024

There is a another, similar change that would also fix the issue: passing the keyword argument newline='' to the tempfile.NamedTemporaryFile constructor would also prevent line-ending translations. I went with the binary mode fix in this PR only because it creates a nice parity with mypy, which reads the content of the file in binary mode.

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.

Plugin returns wrong line numbers for some diagnostics
1 participant