sourcery-ai / sourcery

Instant AI code reviews
https://sourcery.ai
MIT License
1.5k stars 65 forks source link

Code Lens becomes misaligned after new line #393

Closed Magnymbus closed 8 months ago

Magnymbus commented 9 months ago

Description

Better explained with screenshots. Every new line offsets the code lens to where the method would be without the line. image

This is what it should be. image

Related to #394 as the auto-scroll only occurs after the code lens becomes significantly misaligned.

EDIT: Is resolved on file save, making autosave afterDelay with default delay sufficient to mitigate the issue.

Debug Information

Operating system and Version: Windows 11 Home 22H2 (v10.0.22621)

Sourcery Version: v1.10.1 v1.10.0

IDE Version: VSCode v1.83 VSCode v1.82

Enabled VSCode extensions: AREPL for python v2.0.5 (Almenon) autopep8 v2023.6.0 (Microsoft) Bookmarks v13.4.1 (Alessandro Fragnani) Formatting Toggle v3.2.0 (tombonnike) Hex Editor v1.6.12 (Microsoft) indent-rainbow v8.3.1 (oderwat) IntelliCode v1.2.30 (Microsoft) Mintlify Doc Writer v2.2.1 (Mintlify) Project Manager v12.7.0 (Alessandro Fragnani) Pylance v2023.9.30 (Microsoft) Python v2023.16.0 (Microsoft) Python Environment Manager v1.2.4 (Don Jayamanne) Python Indent v1.18.0 (Kevin Rose) Todo Tree v0.0.26 (Gruntfuggly) vscode-icons v12.5.0 (VSCode Icons Team)

Hellebore commented 9 months ago

Hi @Magnymbus - thanks for raising the issue. I can't reproduce this - so a couple of questions:

One thing to note is that we have a command to turn the code lenses off (if the behaviour is annoying you before we can track it down and fix it)

Magnymbus commented 9 months ago

It happens specifically when adding lines to the top or middle of the document, and at or below where the lines were added; any code on the same line since the last save is unaffected. It is resolved on file save, which seems to reset the code lens positions. However, It does NOT resolve with time. Turning off code lens is also a perfectly valid workaround, as long as you aren't using those four links/buttons.

EDIT: Clarification

EDIT: Is resolved on file save, making autosave afterDelay with default delay sufficient to mitigate the issue.

Hellebore commented 9 months ago

Thanks for that @Magnymbus - have now tried it on a Windows machine and can reproduce it - investigating.

Hellebore commented 8 months ago

Have put in a fix so this should be addressed in our next release

ruancomelli commented 8 months ago

A fix for this issue has just been released. Thanks for reporting this issue, and please let us know if it happens again!