python-lsp / pylsp-mypy

Mypy plugin for the Python LSP Server.
MIT License
118 stars 35 forks source link

Add error end functionality #62

Closed AntonVucinic closed 1 year ago

AntonVucinic commented 1 year ago

Code change for issue #61.

I also noticed that the field code of Diagnositc is unused but rather errors were parsed in such a way that the mypy error code was included in the diagnostic message. I think this is a bug and am also willing to fix it.

AntonVucinic commented 1 year ago

According to LSP docs the end position is exclusive so I just fixed that with the second commit

AntonVucinic commented 1 year ago

Sorry for the wait but I fixed it in what I think is the best way possible and I also manually ran tests in all 5 versions and all seems to work fine. It is a lot of changes though.

In short I removed the redundant tests that were testing for lines with partial information. I also modified the other tests so that they check that other fields of diagnostic are also correctly parsed.

Richardk2n commented 1 year ago

Don't worry. I appreciate every contribution.

How did you handle the python 3.7 I don't see any special code for that?

AntonVucinic commented 1 year ago

As you said I didn't. I only modified the test case that depended on the actual output of mypy so taht it would pass in 3.7. The other tests use predefined output lines so they were fine.

Richardk2n commented 1 year ago

Fyi, I made a bug report at https://github.com/python/mypy/issues/15281 to assure 3.7 is actually broken, and we did not misunderstand something. Other than that I am rather happy with your changes and will merge them soon. Sorry for the delay.