microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.93k stars 28.77k forks source link

[wrapped lines] inline chat zone shows on the wrong line #196491

Open gregvanl opened 11 months ago

gregvanl commented 11 months ago

Testing #196258

  1. Open a Markdown file and go to an empty line below a paragraph. The example below used https://github.com/microsoft/vscode-docs/blob/main/docs/getstarted/userinterface.md in a local clone of the vscode-docs repo.

image

  1. Click on the gutter sparkle icon.

The inline change opens one line above the empty line.

image

This is not limited to the clicking the sparkle icon. This also happens if you use Ctrrl+I to open the inline chat

aiday-mar commented 11 months ago

Hi @gregvanl, I looked into this, it looks like this is caused because wordwrap is enabled and the zone widget is placed between the two parts of the wrapped line. When word wrap is disabled, the zone widget is placed as expected.

https://github.com/microsoft/vscode/assets/61460952/6bb436d3-786d-405a-ba9a-6ff54946130b

I was wondering if this is expected behavior @jrieken ?

jrieken commented 9 months ago

I was wondering if this is expected behavior @jrieken ?

This is likely a broader issue with editor view zones which is the editor API that enables this

jrieken commented 9 months ago

Assuming line 7 wraps and chat is invoked on line 8, then we create a view zone with afterLineNumber: 7 which doesn't seem to take view lines into account