python-lsp / python-lsp-server

Fork of the python-language-server project, maintained by the Spyder IDE team and the community
MIT License
1.75k stars 186 forks source link

Fix extra end line increment in autopep8 plugin #507

Closed remisalmon closed 6 months ago

remisalmon commented 6 months ago

This is fixing a bug where the line range end (inclusive) is incremented twice, first line 32 just above resulting in formatting an extra line of text.

Tested with Spyder, before:

https://github.com/python-lsp/python-lsp-server/assets/26257211/9db88c47-d251-42f1-83f1-14f897230665

After:

https://github.com/python-lsp/python-lsp-server/assets/26257211/81e79f6c-ae9d-4440-bae2-ec8fe7650a76

Same logic in the black plugin: